fix proot
This commit is contained in:
parent
8db7cb5b11
commit
ebdbd3f84f
@ -260,8 +260,8 @@
|
||||
-ifndef('DEVICEMAPPING_PB_H').
|
||||
-define('DEVICEMAPPING_PB_H', true).
|
||||
-record('DeviceMapping',
|
||||
{host_path = <<>> :: unicode:chardata() | undefined, % = 1, optional
|
||||
container_path = <<>> :: unicode:chardata() | undefined, % = 2, optional
|
||||
{path_on_host = <<>> :: unicode:chardata() | undefined, % = 1, optional
|
||||
path_in_container = <<>> :: unicode:chardata() | undefined, % = 2, optional
|
||||
cgroup_permissions = <<>> :: unicode:chardata() | undefined % = 3, optional
|
||||
}).
|
||||
-endif.
|
||||
|
||||
@ -1,134 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message ContainerRef {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
}
|
||||
|
||||
message ContainerRequest {
|
||||
message List {
|
||||
bool all = 1;
|
||||
}
|
||||
|
||||
message Deploy {
|
||||
uint32 task_id = 1;
|
||||
ContainerDeployParams params = 2;
|
||||
}
|
||||
|
||||
message Start {
|
||||
ContainerRef target = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
ContainerRef target = 1;
|
||||
uint32 timeout_seconds = 2;
|
||||
}
|
||||
|
||||
message Kill {
|
||||
ContainerRef target = 1;
|
||||
string signal = 2;
|
||||
}
|
||||
|
||||
message Remove {
|
||||
ContainerRef target = 1;
|
||||
bool force = 2;
|
||||
bool remove_volumes = 3;
|
||||
}
|
||||
|
||||
message Config {
|
||||
ContainerRef target = 1;
|
||||
bytes config = 2;
|
||||
}
|
||||
|
||||
oneof action {
|
||||
List list = 10;
|
||||
Deploy deploy = 11;
|
||||
Start start = 12;
|
||||
Stop stop = 13;
|
||||
Kill kill = 14;
|
||||
Remove remove = 15;
|
||||
Config config = 16;
|
||||
}
|
||||
}
|
||||
|
||||
message ContainerDeployParams {
|
||||
string container_name = 1;
|
||||
string container_dir = 2;
|
||||
DockerCreateOptions create = 3;
|
||||
}
|
||||
|
||||
message DockerCreateOptions {
|
||||
DockerContainerConfig config = 1;
|
||||
DockerHostConfig host_config = 2;
|
||||
DockerNetworkingConfig networking_config = 3;
|
||||
}
|
||||
|
||||
message DockerContainerConfig {
|
||||
string image = 1;
|
||||
repeated string cmd = 2;
|
||||
repeated string entrypoint = 3;
|
||||
|
||||
repeated string env = 4;
|
||||
map<string, string> labels = 5;
|
||||
repeated string volumes = 6;
|
||||
string user = 7;
|
||||
string working_dir = 8;
|
||||
string hostname = 9;
|
||||
repeated DockerExposedPort exposed_ports = 10;
|
||||
Healthcheck healthcheck = 11;
|
||||
}
|
||||
|
||||
message DockerHostConfig {
|
||||
repeated string binds = 1;
|
||||
string network_mode = 2;
|
||||
RestartPolicy restart_policy = 3;
|
||||
bool privileged = 4;
|
||||
repeated string cap_add = 5;
|
||||
repeated string cap_drop = 6;
|
||||
repeated DeviceMapping devices = 7;
|
||||
uint64 memory = 8;
|
||||
uint64 memory_reservation = 9;
|
||||
uint64 nano_cpus = 10;
|
||||
uint64 cpu_shares = 11;
|
||||
repeated Ulimit ulimits = 12;
|
||||
map<string, string> tmpfs = 13;
|
||||
map<string, string> sysctls = 14;
|
||||
repeated string extra_hosts = 15;
|
||||
}
|
||||
|
||||
message DockerNetworkingConfig {
|
||||
repeated DockerNetworkEndpoint endpoints = 1;
|
||||
}
|
||||
|
||||
message DockerNetworkEndpoint {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DockerExposedPort {
|
||||
uint32 container_port = 1;
|
||||
string protocol = 2; // tcp / udp
|
||||
}
|
||||
|
||||
message Healthcheck {
|
||||
repeated string test = 1;
|
||||
uint64 interval_ns = 2;
|
||||
uint64 timeout_ns = 3;
|
||||
uint32 retries = 4;
|
||||
}
|
||||
|
||||
message RestartPolicy {
|
||||
string name = 1; // no, always, unless-stopped, on-failure
|
||||
uint32 maximum_retry_count = 2;
|
||||
}
|
||||
|
||||
message DeviceMapping {
|
||||
string host_path = 1;
|
||||
string container_path = 2;
|
||||
string cgroup_permissions = 3; // 默认可填 rwm
|
||||
}
|
||||
|
||||
message Ulimit {
|
||||
string name = 1;
|
||||
uint64 soft = 2;
|
||||
uint64 hard = 3;
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "docker.proto";
|
||||
|
||||
// 整体封装的消息体
|
||||
message RequestFrame {
|
||||
uint32 packet_id = 1;
|
||||
oneof body {
|
||||
AuthRequest auth_request = 2;
|
||||
ContainerRequest container_request = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReplyFrame {
|
||||
uint32 packet_id = 1;
|
||||
oneof reply {
|
||||
ReplyResult result = 2;
|
||||
ReplyError error = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReplyResult {
|
||||
bytes data = 1;
|
||||
}
|
||||
|
||||
message ReplyError {
|
||||
int32 code = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
message CastFrame {
|
||||
oneof body {
|
||||
Pub pub = 1;
|
||||
Command command = 2;
|
||||
Data data = 3;
|
||||
TaskEventStream event_stream = 4;
|
||||
}
|
||||
}
|
||||
|
||||
// message定义
|
||||
message AuthRequest {
|
||||
bytes uuid = 1;
|
||||
bytes username = 2;
|
||||
bytes salt = 3;
|
||||
bytes token = 4;
|
||||
int32 timestamp = 5;
|
||||
}
|
||||
|
||||
message Pub {
|
||||
bytes topic = 1;
|
||||
int32 qos = 2;
|
||||
bytes content = 3;
|
||||
}
|
||||
|
||||
message Command {
|
||||
int32 command_type = 1;
|
||||
bytes command = 2;
|
||||
}
|
||||
|
||||
message Data {
|
||||
bytes route_key = 1;
|
||||
bytes metric = 2;
|
||||
}
|
||||
|
||||
message TaskEventStream {
|
||||
int32 task_id = 1;
|
||||
bytes type = 2;
|
||||
bytes stream = 3;
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// 微服务通过 ws_channel 与 efka 之间的通道消息定义。
|
||||
// 该协议用于替代当前基于 JSON 的请求/响应/推送格式。
|
||||
|
||||
message ServiceRequest {
|
||||
uint32 packet_id = 1;
|
||||
|
||||
message Register {
|
||||
string service_id = 1;
|
||||
}
|
||||
|
||||
message Subscribe {
|
||||
string topic = 1;
|
||||
}
|
||||
|
||||
oneof request {
|
||||
Register register = 10;
|
||||
Subscribe subscribe = 11;
|
||||
}
|
||||
}
|
||||
|
||||
message ServiceReply {
|
||||
uint32 packet_id = 1;
|
||||
|
||||
message Error {
|
||||
int32 code = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
oneof reply {
|
||||
bytes result = 10;
|
||||
Error error = 11;
|
||||
}
|
||||
}
|
||||
|
||||
message ServiceCast {
|
||||
|
||||
message MetricData {
|
||||
bytes route_key = 1;
|
||||
bytes metric = 2;
|
||||
}
|
||||
|
||||
message TopicEvent {
|
||||
string topic = 1;
|
||||
bytes content = 2;
|
||||
}
|
||||
|
||||
oneof body {
|
||||
TopicEvent topic_event = 10;
|
||||
MetricData metric_data = 11;
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,8 +8,8 @@
|
||||
% 核心:强制指定 proto 路径 + 输出到你的 apps/sdlan
|
||||
% ======================
|
||||
{gpb_opts, [
|
||||
{i, "proto"}, % proto 文件路径
|
||||
{src_dirs, ["proto"]}, % 源码目录(必须)
|
||||
{i, "../proto"}, % 共享 proto 文件路径
|
||||
{src_dirs, ["../proto"]}, % 源码目录(必须)
|
||||
{f, ["message.proto", "service.proto"]},
|
||||
recursive, % 递归查找 proto 文件
|
||||
{module_name_suffix, "_pb"}, % 生成模块后缀
|
||||
|
||||
@ -241,8 +241,8 @@ build_devices(Devices) when is_list(Devices) ->
|
||||
<<"PathInContainer">> => to_binary(ContainerPath),
|
||||
<<"CgroupPermissions">> => device_permissions(Permissions)
|
||||
} || #'DeviceMapping'{
|
||||
host_path = HostPath,
|
||||
container_path = ContainerPath,
|
||||
path_on_host = HostPath,
|
||||
path_in_container = ContainerPath,
|
||||
cgroup_permissions = Permissions
|
||||
} <- Devices],
|
||||
#{<<"Devices">> => DevObjs}
|
||||
|
||||
@ -1029,7 +1029,7 @@ encode_msg_RestartPolicy(#'RestartPolicy'{name = F1, maximum_retry_count = F2},
|
||||
encode_msg_DeviceMapping(Msg, TrUserData) -> encode_msg_DeviceMapping(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
encode_msg_DeviceMapping(#'DeviceMapping'{host_path = F1, container_path = F2, cgroup_permissions = F3}, Bin, TrUserData) ->
|
||||
encode_msg_DeviceMapping(#'DeviceMapping'{path_on_host = F1, path_in_container = F2, cgroup_permissions = F3}, Bin, TrUserData) ->
|
||||
B1 = if F1 == undefined -> Bin;
|
||||
true ->
|
||||
begin
|
||||
@ -3590,18 +3590,18 @@ skip_64_RestartPolicy(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData)
|
||||
|
||||
decode_msg_DeviceMapping(Bin, TrUserData) -> dfp_read_field_def_DeviceMapping(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_DeviceMapping(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_DeviceMapping_host_path(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dfp_read_field_def_DeviceMapping(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_DeviceMapping_container_path(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dfp_read_field_def_DeviceMapping(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_DeviceMapping_path_on_host(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dfp_read_field_def_DeviceMapping(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_DeviceMapping_path_in_container(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dfp_read_field_def_DeviceMapping(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_DeviceMapping_cgroup_permissions(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dfp_read_field_def_DeviceMapping(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #'DeviceMapping'{host_path = F@_1, container_path = F@_2, cgroup_permissions = F@_3};
|
||||
dfp_read_field_def_DeviceMapping(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #'DeviceMapping'{path_on_host = F@_1, path_in_container = F@_2, cgroup_permissions = F@_3};
|
||||
dfp_read_field_def_DeviceMapping(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_DeviceMapping(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
dg_read_field_def_DeviceMapping(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_DeviceMapping(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dg_read_field_def_DeviceMapping(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) ->
|
||||
Key = X bsl N + Acc,
|
||||
case Key of
|
||||
10 -> d_field_DeviceMapping_host_path(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
|
||||
18 -> d_field_DeviceMapping_container_path(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
|
||||
10 -> d_field_DeviceMapping_path_on_host(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
|
||||
18 -> d_field_DeviceMapping_path_in_container(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
|
||||
26 -> d_field_DeviceMapping_cgroup_permissions(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
|
||||
_ ->
|
||||
case Key band 7 of
|
||||
@ -3612,15 +3612,15 @@ dg_read_field_def_DeviceMapping(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2
|
||||
5 -> skip_32_DeviceMapping(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData)
|
||||
end
|
||||
end;
|
||||
dg_read_field_def_DeviceMapping(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #'DeviceMapping'{host_path = F@_1, container_path = F@_2, cgroup_permissions = F@_3}.
|
||||
dg_read_field_def_DeviceMapping(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #'DeviceMapping'{path_on_host = F@_1, path_in_container = F@_2, cgroup_permissions = F@_3}.
|
||||
|
||||
d_field_DeviceMapping_host_path(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_DeviceMapping_host_path(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
d_field_DeviceMapping_host_path(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) ->
|
||||
d_field_DeviceMapping_path_on_host(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_DeviceMapping_path_on_host(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
d_field_DeviceMapping_path_on_host(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) ->
|
||||
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
|
||||
dfp_read_field_def_DeviceMapping(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData).
|
||||
|
||||
d_field_DeviceMapping_container_path(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_DeviceMapping_container_path(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
d_field_DeviceMapping_container_path(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) ->
|
||||
d_field_DeviceMapping_path_in_container(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_DeviceMapping_path_in_container(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
d_field_DeviceMapping_path_in_container(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) ->
|
||||
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
|
||||
dfp_read_field_def_DeviceMapping(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData).
|
||||
|
||||
@ -4320,15 +4320,15 @@ merge_msg_RestartPolicy(#'RestartPolicy'{name = PFname, maximum_retry_count = PF
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_DeviceMapping/3}).
|
||||
merge_msg_DeviceMapping(#'DeviceMapping'{host_path = PFhost_path, container_path = PFcontainer_path, cgroup_permissions = PFcgroup_permissions},
|
||||
#'DeviceMapping'{host_path = NFhost_path, container_path = NFcontainer_path, cgroup_permissions = NFcgroup_permissions}, _) ->
|
||||
#'DeviceMapping'{host_path =
|
||||
if NFhost_path =:= undefined -> PFhost_path;
|
||||
true -> NFhost_path
|
||||
merge_msg_DeviceMapping(#'DeviceMapping'{path_on_host = PFpath_on_host, path_in_container = PFpath_in_container, cgroup_permissions = PFcgroup_permissions},
|
||||
#'DeviceMapping'{path_on_host = NFpath_on_host, path_in_container = NFpath_in_container, cgroup_permissions = NFcgroup_permissions}, _) ->
|
||||
#'DeviceMapping'{path_on_host =
|
||||
if NFpath_on_host =:= undefined -> PFpath_on_host;
|
||||
true -> NFpath_on_host
|
||||
end,
|
||||
container_path =
|
||||
if NFcontainer_path =:= undefined -> PFcontainer_path;
|
||||
true -> NFcontainer_path
|
||||
path_in_container =
|
||||
if NFpath_in_container =:= undefined -> PFpath_in_container;
|
||||
true -> NFpath_in_container
|
||||
end,
|
||||
cgroup_permissions =
|
||||
if NFcgroup_permissions =:= undefined -> PFcgroup_permissions;
|
||||
@ -4953,12 +4953,12 @@ v_submsg_DeviceMapping(Msg, Path, TrUserData) -> v_msg_DeviceMapping(Msg, Path,
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_DeviceMapping/3}).
|
||||
-dialyzer({nowarn_function,v_msg_DeviceMapping/3}).
|
||||
v_msg_DeviceMapping(#'DeviceMapping'{host_path = F1, container_path = F2, cgroup_permissions = F3}, Path, TrUserData) ->
|
||||
v_msg_DeviceMapping(#'DeviceMapping'{path_on_host = F1, path_in_container = F2, cgroup_permissions = F3}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_string(F1, [host_path | Path], TrUserData)
|
||||
true -> v_type_string(F1, [path_on_host | Path], TrUserData)
|
||||
end,
|
||||
if F2 == undefined -> ok;
|
||||
true -> v_type_string(F2, [container_path | Path], TrUserData)
|
||||
true -> v_type_string(F2, [path_in_container | Path], TrUserData)
|
||||
end,
|
||||
if F3 == undefined -> ok;
|
||||
true -> v_type_string(F3, [cgroup_permissions | Path], TrUserData)
|
||||
@ -5249,8 +5249,8 @@ get_msg_defs() ->
|
||||
#field{name = retries, fnum = 4, rnum = 5, type = uint32, occurrence = optional, opts = []}]},
|
||||
{{msg, 'RestartPolicy'}, [#field{name = name, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = maximum_retry_count, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}]},
|
||||
{{msg, 'DeviceMapping'},
|
||||
[#field{name = host_path, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
#field{name = container_path, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
[#field{name = path_on_host, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
#field{name = path_in_container, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
#field{name = cgroup_permissions, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, 'Ulimit'},
|
||||
[#field{name = name, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
@ -5445,8 +5445,8 @@ find_msg_def('Healthcheck') ->
|
||||
#field{name = retries, fnum = 4, rnum = 5, type = uint32, occurrence = optional, opts = []}];
|
||||
find_msg_def('RestartPolicy') -> [#field{name = name, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = maximum_retry_count, fnum = 2, rnum = 3, type = uint32, occurrence = optional, opts = []}];
|
||||
find_msg_def('DeviceMapping') ->
|
||||
[#field{name = host_path, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
#field{name = container_path, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
[#field{name = path_on_host, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
#field{name = path_in_container, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
#field{name = cgroup_permissions, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def('Ulimit') ->
|
||||
[#field{name = name, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user