fix
This commit is contained in:
parent
a9ee682b20
commit
7e2f164459
@ -19,8 +19,6 @@
|
||||
-define(METHOD_INFORM, 16#04).
|
||||
-define(METHOD_EVENT, 16#07).
|
||||
-define(METHOD_PHASE, 16#09).
|
||||
-define(METHOD_DEPLOY, 16#10).
|
||||
|
||||
%% 服务器基于pub/sub的消息
|
||||
-define(PACKET_PUB, 16#03).
|
||||
|
||||
|
||||
@ -35,6 +35,15 @@
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('PUSH_REPLY_PB_H').
|
||||
-define('PUSH_REPLY_PB_H', true).
|
||||
-record(push_reply,
|
||||
{code = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
|
||||
result = <<>> :: unicode:chardata() | undefined, % = 2, optional
|
||||
message = <<>> :: unicode:chardata() | undefined % = 3, optional
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('DEPLOY_PB_H').
|
||||
-define('DEPLOY_PB_H', true).
|
||||
-record(deploy,
|
||||
@ -44,13 +53,6 @@
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('DEPLOY_REPLY_PB_H').
|
||||
-define('DEPLOY_REPLY_PB_H', true).
|
||||
-record(deploy_reply,
|
||||
{
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('INVOKE_PB_H').
|
||||
-define('INVOKE_PB_H', true).
|
||||
-record(invoke,
|
||||
@ -59,13 +61,6 @@
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('INVOKE_REPLY_PB_H').
|
||||
-define('INVOKE_REPLY_PB_H', true).
|
||||
-record(invoke_reply,
|
||||
{response = <<>> :: unicode:chardata() | undefined % = 1, optional
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('SERVICE_CONFIG_PB_H').
|
||||
-define('SERVICE_CONFIG_PB_H', true).
|
||||
-record(service_config,
|
||||
@ -75,13 +70,6 @@
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('SERVICE_CONFIG_REPLY_PB_H').
|
||||
-define('SERVICE_CONFIG_REPLY_PB_H', true).
|
||||
-record(service_config_reply,
|
||||
{
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('DATA_PB_H').
|
||||
-define('DATA_PB_H', true).
|
||||
-record(data,
|
||||
|
||||
@ -231,29 +231,26 @@ handle_info({auth_reply, {error, Reason}}, State = #state{transport_pid = Transp
|
||||
%% 激活消息
|
||||
|
||||
%% 微服务部署
|
||||
handle_info({server_push_message, PacketId, <<?METHOD_DEPLOY:8, DeployBin/binary>>}, State = #state{transport_pid = TransportPid}) ->
|
||||
handle_info({server_push, PacketId, <<?PUSH_DEPLOY:8, DeployBin/binary>>}, State = #state{transport_pid = TransportPid}) ->
|
||||
#deploy{task_id = TaskId, service_id = ServiceId, tar_url = TarUrl} = message_pb:decode_msg(DeployBin, deploy),
|
||||
|
||||
Reply = case efka_inetd:deploy(TaskId, ServiceId, TarUrl) of
|
||||
ok ->
|
||||
#efka_response{code = 1, message = <<"">>};
|
||||
#push_reply{code = 1, message = <<"">>};
|
||||
{error, Reason} when is_binary(Reason) ->
|
||||
#efka_response{code = 1, message = Reason}
|
||||
#push_reply{code = 1, message = Reason}
|
||||
end,
|
||||
efka_transport:response(TransportPid, PacketId, message_pb:encode_msg(Reply)),
|
||||
|
||||
{noreply, State};
|
||||
|
||||
%% config.json配置信息
|
||||
handle_info({server_push_message, PacketId, <<?METHOD_CONFIG:8, ParamsBin/binary>>}, State = #state{transport_pid = TransportPid, inflight = Inflight}) ->
|
||||
#service_config{service_id = ServiceId, config_json = ConfigJson, timeout = Timeout} = message_pb:decode_msg(ParamsBin, service_config),
|
||||
handle_info({server_push, PacketId, <<?PUSH_SERVICE_CONFIG:8, ConfigBin/binary>>}, State = #state{transport_pid = TransportPid, inflight = Inflight}) ->
|
||||
#service_config{service_id = ServiceId, config_json = ConfigJson, timeout = Timeout} = message_pb:decode_msg(ConfigBin, service_config),
|
||||
|
||||
case efka_service:get_pid(ServiceId) of
|
||||
undefined ->
|
||||
Reply = #efka_response {
|
||||
code = 0,
|
||||
message = <<"service not run">>
|
||||
},
|
||||
Reply = #push_reply{code = 0, message = <<"service not run">>, result = <<>>},
|
||||
efka_transport:response(TransportPid, PacketId, message_pb:encode_msg(Reply)),
|
||||
{noreply, State};
|
||||
ServicePid when is_pid(ServicePid) ->
|
||||
@ -267,6 +264,20 @@ handle_info({server_push_message, PacketId, <<?METHOD_CONFIG:8, ParamsBin/binary
|
||||
end,
|
||||
{noreply, State};
|
||||
|
||||
%% 收到需要回复的指令
|
||||
handle_info({server_push, PacketId, Invoke = #invoke{service_id = ServiceId}}, State = #state{transport_pid = TransportPid, status = ?STATE_ACTIVATED}) ->
|
||||
efka_logger:debug("[efka_agent] get invoke: ~p", [Invoke]),
|
||||
%% 消息发送到订阅系统
|
||||
case efka_service:get_pid(ServiceId) of
|
||||
undefined ->
|
||||
Reply = #push_reply{code = 0, message = <<"micro_service not run">>, result = <<>>},
|
||||
safe_response(PacketId, message_pb:encode_msg(Reply), State);
|
||||
ServicePid when is_pid(ServicePid) ->
|
||||
ok
|
||||
end,
|
||||
|
||||
{noreply, State};
|
||||
|
||||
%% 处理命令
|
||||
handle_info({command, ?COMMAND_AUTH, <<Auth:8>>}, State = #state{transport_pid = TransportPid, status = Status}) ->
|
||||
case {Auth, Status} of
|
||||
@ -289,20 +300,6 @@ handle_info({pub, Topic, Content}, State = #state{status = ?STATE_ACTIVATED}) ->
|
||||
|
||||
{noreply, State};
|
||||
|
||||
%% 收到需要回复的指令
|
||||
handle_info({async_request, PacketId, AsyncRequest = #async_request{service_id = ServiceId}}, State = #state{transport_pid = TransportPid, status = ?STATE_ACTIVATED}) ->
|
||||
efka_logger:debug("[efka_agent] get aync_request: ~p", [AsyncRequest]),
|
||||
%% 消息发送到订阅系统
|
||||
case efka_service:get_pid(ServiceId) of
|
||||
undefined ->
|
||||
Reply = #async_response{code = 0, message = <<"micro_service not run">>, result = <<>>},
|
||||
safe_response(PacketId, message_pb:encode_msg(Reply), State);
|
||||
ServicePid when is_pid(ServicePid) ->
|
||||
ok
|
||||
end,
|
||||
|
||||
{noreply, State};
|
||||
|
||||
%% 收到来自efka_service的回复
|
||||
handle_info({ems_reply, Ref, EmsReply}, State = #state{inflight = Inflight}) ->
|
||||
case maps:take(Ref, Inflight) of
|
||||
@ -311,9 +308,9 @@ handle_info({ems_reply, Ref, EmsReply}, State = #state{inflight = Inflight}) ->
|
||||
{PacketId, NInflight} ->
|
||||
Reply = case EmsReply of
|
||||
ok ->
|
||||
#efka_response{code = 1, message = <<"">>};
|
||||
#push_reply{code = 1, message = <<"">>, result = <<>>};
|
||||
{error, Reason} ->
|
||||
#efka_response{code = 0, message = Reason}
|
||||
#push_reply{code = 0, message = Reason}
|
||||
end,
|
||||
safe_response(PacketId, message_pb:encode_msg(Reply), State),
|
||||
|
||||
@ -326,14 +323,12 @@ handle_info({timeout, _, {request_timeout, Ref}}, State = #state{inflight = Infl
|
||||
error ->
|
||||
{noreply, State};
|
||||
{PacketId, NInflight} ->
|
||||
Reply = #efka_response{code = 0, message = <<"reqeust timeout">>},
|
||||
Reply = #push_reply{code = 0, message = <<"reqeust timeout">>, result = <<>>},
|
||||
safe_response(PacketId, message_pb:encode_msg(Reply), State),
|
||||
|
||||
{noreply, State#state{inflight = NInflight}}
|
||||
end;
|
||||
|
||||
|
||||
|
||||
%% transport进程退出
|
||||
handle_info({'EXIT', TransportPid, Reason}, State = #state{transport_pid = TransportPid}) ->
|
||||
efka_logger:debug("[efka_agent] transport pid: ~p, exit with reason: ~p", [TransportPid, Reason]),
|
||||
|
||||
@ -61,18 +61,14 @@
|
||||
|
||||
-type pub() :: #pub{}.
|
||||
|
||||
-type deploy() :: #deploy{}.
|
||||
-type push_reply() :: #push_reply{}.
|
||||
|
||||
-type deploy_reply() :: #deploy_reply{}.
|
||||
-type deploy() :: #deploy{}.
|
||||
|
||||
-type invoke() :: #invoke{}.
|
||||
|
||||
-type invoke_reply() :: #invoke_reply{}.
|
||||
|
||||
-type service_config() :: #service_config{}.
|
||||
|
||||
-type service_config_reply() :: #service_config_reply{}.
|
||||
|
||||
-type data() :: #data{}.
|
||||
|
||||
-type ping() :: #ping{}.
|
||||
@ -83,9 +79,9 @@
|
||||
|
||||
-type event() :: #event{}.
|
||||
|
||||
-export_type(['auth_request'/0, 'auth_reply'/0, 'pub'/0, 'deploy'/0, 'deploy_reply'/0, 'invoke'/0, 'invoke_reply'/0, 'service_config'/0, 'service_config_reply'/0, 'data'/0, 'ping'/0, 'service_inform'/0, 'feedback_phase'/0, 'event'/0]).
|
||||
-type '$msg_name'() :: auth_request | auth_reply | pub | deploy | deploy_reply | invoke | invoke_reply | service_config | service_config_reply | data | ping | service_inform | feedback_phase | event.
|
||||
-type '$msg'() :: auth_request() | auth_reply() | pub() | deploy() | deploy_reply() | invoke() | invoke_reply() | service_config() | service_config_reply() | data() | ping() | service_inform() | feedback_phase() | event().
|
||||
-export_type(['auth_request'/0, 'auth_reply'/0, 'pub'/0, 'push_reply'/0, 'deploy'/0, 'invoke'/0, 'service_config'/0, 'data'/0, 'ping'/0, 'service_inform'/0, 'feedback_phase'/0, 'event'/0]).
|
||||
-type '$msg_name'() :: auth_request | auth_reply | pub | push_reply | deploy | invoke | service_config | data | ping | service_inform | feedback_phase | event.
|
||||
-type '$msg'() :: auth_request() | auth_reply() | pub() | push_reply() | deploy() | invoke() | service_config() | data() | ping() | service_inform() | feedback_phase() | event().
|
||||
-export_type(['$msg_name'/0, '$msg'/0]).
|
||||
|
||||
-if(?OTP_RELEASE >= 24).
|
||||
@ -115,12 +111,10 @@ encode_msg(Msg, MsgName, Opts) ->
|
||||
auth_request -> encode_msg_auth_request(id(Msg, TrUserData), TrUserData);
|
||||
auth_reply -> encode_msg_auth_reply(id(Msg, TrUserData), TrUserData);
|
||||
pub -> encode_msg_pub(id(Msg, TrUserData), TrUserData);
|
||||
push_reply -> encode_msg_push_reply(id(Msg, TrUserData), TrUserData);
|
||||
deploy -> encode_msg_deploy(id(Msg, TrUserData), TrUserData);
|
||||
deploy_reply -> encode_msg_deploy_reply(id(Msg, TrUserData), TrUserData);
|
||||
invoke -> encode_msg_invoke(id(Msg, TrUserData), TrUserData);
|
||||
invoke_reply -> encode_msg_invoke_reply(id(Msg, TrUserData), TrUserData);
|
||||
service_config -> encode_msg_service_config(id(Msg, TrUserData), TrUserData);
|
||||
service_config_reply -> encode_msg_service_config_reply(id(Msg, TrUserData), TrUserData);
|
||||
data -> encode_msg_data(id(Msg, TrUserData), TrUserData);
|
||||
ping -> encode_msg_ping(id(Msg, TrUserData), TrUserData);
|
||||
service_inform -> encode_msg_service_inform(id(Msg, TrUserData), TrUserData);
|
||||
@ -232,6 +226,40 @@ encode_msg_pub(#pub{topic = F1, content = F2}, Bin, TrUserData) ->
|
||||
end
|
||||
end.
|
||||
|
||||
encode_msg_push_reply(Msg, TrUserData) -> encode_msg_push_reply(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
encode_msg_push_reply(#push_reply{code = F1, result = F2, message = F3}, Bin, TrUserData) ->
|
||||
B1 = if F1 == undefined -> Bin;
|
||||
true ->
|
||||
begin
|
||||
TrF1 = id(F1, TrUserData),
|
||||
if TrF1 =:= 0 -> Bin;
|
||||
true -> e_varint(TrF1, <<Bin/binary, 8>>, TrUserData)
|
||||
end
|
||||
end
|
||||
end,
|
||||
B2 = if F2 == undefined -> B1;
|
||||
true ->
|
||||
begin
|
||||
TrF2 = id(F2, TrUserData),
|
||||
case is_empty_string(TrF2) of
|
||||
true -> B1;
|
||||
false -> e_type_string(TrF2, <<B1/binary, 18>>, TrUserData)
|
||||
end
|
||||
end
|
||||
end,
|
||||
if F3 == undefined -> B2;
|
||||
true ->
|
||||
begin
|
||||
TrF3 = id(F3, TrUserData),
|
||||
case is_empty_string(TrF3) of
|
||||
true -> B2;
|
||||
false -> e_type_string(TrF3, <<B2/binary, 26>>, TrUserData)
|
||||
end
|
||||
end
|
||||
end.
|
||||
|
||||
encode_msg_deploy(Msg, TrUserData) -> encode_msg_deploy(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
@ -266,8 +294,6 @@ encode_msg_deploy(#deploy{task_id = F1, service_id = F2, tar_url = F3}, Bin, TrU
|
||||
end
|
||||
end.
|
||||
|
||||
encode_msg_deploy_reply(_Msg, _TrUserData) -> <<>>.
|
||||
|
||||
encode_msg_invoke(Msg, TrUserData) -> encode_msg_invoke(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
@ -293,21 +319,6 @@ encode_msg_invoke(#invoke{service_id = F1, payload = F2}, Bin, TrUserData) ->
|
||||
end
|
||||
end.
|
||||
|
||||
encode_msg_invoke_reply(Msg, TrUserData) -> encode_msg_invoke_reply(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
encode_msg_invoke_reply(#invoke_reply{response = F1}, Bin, TrUserData) ->
|
||||
if F1 == undefined -> Bin;
|
||||
true ->
|
||||
begin
|
||||
TrF1 = id(F1, TrUserData),
|
||||
case is_empty_string(TrF1) of
|
||||
true -> Bin;
|
||||
false -> e_type_string(TrF1, <<Bin/binary, 10>>, TrUserData)
|
||||
end
|
||||
end
|
||||
end.
|
||||
|
||||
encode_msg_service_config(Msg, TrUserData) -> encode_msg_service_config(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
@ -342,8 +353,6 @@ encode_msg_service_config(#service_config{service_id = F1, config_json = F2, tim
|
||||
end
|
||||
end.
|
||||
|
||||
encode_msg_service_config_reply(_Msg, _TrUserData) -> <<>>.
|
||||
|
||||
encode_msg_data(Msg, TrUserData) -> encode_msg_data(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
@ -780,12 +789,10 @@ decode_msg_1_catch(Bin, MsgName, TrUserData) ->
|
||||
decode_msg_2_doit(auth_request, Bin, TrUserData) -> id(decode_msg_auth_request(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(auth_reply, Bin, TrUserData) -> id(decode_msg_auth_reply(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(pub, Bin, TrUserData) -> id(decode_msg_pub(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(push_reply, Bin, TrUserData) -> id(decode_msg_push_reply(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(deploy, Bin, TrUserData) -> id(decode_msg_deploy(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(deploy_reply, Bin, TrUserData) -> id(decode_msg_deploy_reply(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(invoke, Bin, TrUserData) -> id(decode_msg_invoke(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(invoke_reply, Bin, TrUserData) -> id(decode_msg_invoke_reply(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(service_config, Bin, TrUserData) -> id(decode_msg_service_config(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(service_config_reply, Bin, TrUserData) -> id(decode_msg_service_config_reply(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(data, Bin, TrUserData) -> id(decode_msg_data(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(ping, Bin, TrUserData) -> id(decode_msg_ping(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(service_inform, Bin, TrUserData) -> id(decode_msg_service_inform(Bin, TrUserData), TrUserData);
|
||||
@ -968,6 +975,64 @@ skip_32_pub(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_rea
|
||||
|
||||
skip_64_pub(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_pub(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
|
||||
|
||||
decode_msg_push_reply(Bin, TrUserData) -> dfp_read_field_def_push_reply(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_push_reply(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_push_reply_code(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dfp_read_field_def_push_reply(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_push_reply_result(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dfp_read_field_def_push_reply(<<26, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_push_reply_message(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dfp_read_field_def_push_reply(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #push_reply{code = F@_1, result = F@_2, message = F@_3};
|
||||
dfp_read_field_def_push_reply(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_push_reply(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
dg_read_field_def_push_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_push_reply(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
dg_read_field_def_push_reply(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) ->
|
||||
Key = X bsl N + Acc,
|
||||
case Key of
|
||||
8 -> d_field_push_reply_code(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
|
||||
18 -> d_field_push_reply_result(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
|
||||
26 -> d_field_push_reply_message(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
|
||||
_ ->
|
||||
case Key band 7 of
|
||||
0 -> skip_varint_push_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData);
|
||||
1 -> skip_64_push_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData);
|
||||
2 -> skip_length_delimited_push_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData);
|
||||
3 -> skip_group_push_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData);
|
||||
5 -> skip_32_push_reply(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData)
|
||||
end
|
||||
end;
|
||||
dg_read_field_def_push_reply(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #push_reply{code = F@_1, result = F@_2, message = F@_3}.
|
||||
|
||||
d_field_push_reply_code(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_push_reply_code(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
d_field_push_reply_code(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) ->
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest},
|
||||
dfp_read_field_def_push_reply(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData).
|
||||
|
||||
d_field_push_reply_result(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_push_reply_result(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
d_field_push_reply_result(<<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_push_reply(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData).
|
||||
|
||||
d_field_push_reply_message(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_push_reply_message(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
d_field_push_reply_message(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, 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_push_reply(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData).
|
||||
|
||||
skip_varint_push_reply(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_push_reply(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
skip_varint_push_reply(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_push_reply(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
skip_length_delimited_push_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_push_reply(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
skip_length_delimited_push_reply(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) ->
|
||||
Length = X bsl N + Acc,
|
||||
<<_:Length/binary, Rest2/binary>> = Rest,
|
||||
dfp_read_field_def_push_reply(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
skip_group_push_reply(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) ->
|
||||
{_, Rest} = read_group(Bin, FNum),
|
||||
dfp_read_field_def_push_reply(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
skip_32_push_reply(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_push_reply(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
skip_64_push_reply(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_push_reply(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
decode_msg_deploy(Bin, TrUserData) -> dfp_read_field_def_deploy(Bin, 0, 0, 0, id(0, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_deploy(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_deploy_task_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
@ -1026,40 +1091,6 @@ skip_32_deploy(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -
|
||||
|
||||
skip_64_deploy(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_deploy(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
decode_msg_deploy_reply(Bin, TrUserData) -> dfp_read_field_def_deploy_reply(Bin, 0, 0, 0, TrUserData).
|
||||
|
||||
dfp_read_field_def_deploy_reply(<<>>, 0, 0, _, _) -> #deploy_reply{};
|
||||
dfp_read_field_def_deploy_reply(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_deploy_reply(Other, Z1, Z2, F, TrUserData).
|
||||
|
||||
dg_read_field_def_deploy_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_deploy_reply(Rest, N + 7, X bsl N + Acc, F, TrUserData);
|
||||
dg_read_field_def_deploy_reply(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) ->
|
||||
Key = X bsl N + Acc,
|
||||
case Key band 7 of
|
||||
0 -> skip_varint_deploy_reply(Rest, 0, 0, Key bsr 3, TrUserData);
|
||||
1 -> skip_64_deploy_reply(Rest, 0, 0, Key bsr 3, TrUserData);
|
||||
2 -> skip_length_delimited_deploy_reply(Rest, 0, 0, Key bsr 3, TrUserData);
|
||||
3 -> skip_group_deploy_reply(Rest, 0, 0, Key bsr 3, TrUserData);
|
||||
5 -> skip_32_deploy_reply(Rest, 0, 0, Key bsr 3, TrUserData)
|
||||
end;
|
||||
dg_read_field_def_deploy_reply(<<>>, 0, 0, _, _) -> #deploy_reply{}.
|
||||
|
||||
skip_varint_deploy_reply(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_deploy_reply(Rest, Z1, Z2, F, TrUserData);
|
||||
skip_varint_deploy_reply(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_deploy_reply(Rest, Z1, Z2, F, TrUserData).
|
||||
|
||||
skip_length_delimited_deploy_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_deploy_reply(Rest, N + 7, X bsl N + Acc, F, TrUserData);
|
||||
skip_length_delimited_deploy_reply(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) ->
|
||||
Length = X bsl N + Acc,
|
||||
<<_:Length/binary, Rest2/binary>> = Rest,
|
||||
dfp_read_field_def_deploy_reply(Rest2, 0, 0, F, TrUserData).
|
||||
|
||||
skip_group_deploy_reply(Bin, _, Z2, FNum, TrUserData) ->
|
||||
{_, Rest} = read_group(Bin, FNum),
|
||||
dfp_read_field_def_deploy_reply(Rest, 0, Z2, FNum, TrUserData).
|
||||
|
||||
skip_32_deploy_reply(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_deploy_reply(Rest, Z1, Z2, F, TrUserData).
|
||||
|
||||
skip_64_deploy_reply(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_deploy_reply(Rest, Z1, Z2, F, TrUserData).
|
||||
|
||||
decode_msg_invoke(Bin, TrUserData) -> dfp_read_field_def_invoke(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_invoke(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_invoke_service_id(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
|
||||
@ -1111,50 +1142,6 @@ skip_32_invoke(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_
|
||||
|
||||
skip_64_invoke(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_invoke(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
|
||||
|
||||
decode_msg_invoke_reply(Bin, TrUserData) -> dfp_read_field_def_invoke_reply(Bin, 0, 0, 0, id(<<>>, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_invoke_reply(<<10, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> d_field_invoke_reply_response(Rest, Z1, Z2, F, F@_1, TrUserData);
|
||||
dfp_read_field_def_invoke_reply(<<>>, 0, 0, _, F@_1, _) -> #invoke_reply{response = F@_1};
|
||||
dfp_read_field_def_invoke_reply(Other, Z1, Z2, F, F@_1, TrUserData) -> dg_read_field_def_invoke_reply(Other, Z1, Z2, F, F@_1, TrUserData).
|
||||
|
||||
dg_read_field_def_invoke_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 32 - 7 -> dg_read_field_def_invoke_reply(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData);
|
||||
dg_read_field_def_invoke_reply(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, TrUserData) ->
|
||||
Key = X bsl N + Acc,
|
||||
case Key of
|
||||
10 -> d_field_invoke_reply_response(Rest, 0, 0, 0, F@_1, TrUserData);
|
||||
_ ->
|
||||
case Key band 7 of
|
||||
0 -> skip_varint_invoke_reply(Rest, 0, 0, Key bsr 3, F@_1, TrUserData);
|
||||
1 -> skip_64_invoke_reply(Rest, 0, 0, Key bsr 3, F@_1, TrUserData);
|
||||
2 -> skip_length_delimited_invoke_reply(Rest, 0, 0, Key bsr 3, F@_1, TrUserData);
|
||||
3 -> skip_group_invoke_reply(Rest, 0, 0, Key bsr 3, F@_1, TrUserData);
|
||||
5 -> skip_32_invoke_reply(Rest, 0, 0, Key bsr 3, F@_1, TrUserData)
|
||||
end
|
||||
end;
|
||||
dg_read_field_def_invoke_reply(<<>>, 0, 0, _, F@_1, _) -> #invoke_reply{response = F@_1}.
|
||||
|
||||
d_field_invoke_reply_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> d_field_invoke_reply_response(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData);
|
||||
d_field_invoke_reply_response(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, 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_invoke_reply(RestF, 0, 0, F, NewFValue, TrUserData).
|
||||
|
||||
skip_varint_invoke_reply(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> skip_varint_invoke_reply(Rest, Z1, Z2, F, F@_1, TrUserData);
|
||||
skip_varint_invoke_reply(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_invoke_reply(Rest, Z1, Z2, F, F@_1, TrUserData).
|
||||
|
||||
skip_length_delimited_invoke_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) when N < 57 -> skip_length_delimited_invoke_reply(Rest, N + 7, X bsl N + Acc, F, F@_1, TrUserData);
|
||||
skip_length_delimited_invoke_reply(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, TrUserData) ->
|
||||
Length = X bsl N + Acc,
|
||||
<<_:Length/binary, Rest2/binary>> = Rest,
|
||||
dfp_read_field_def_invoke_reply(Rest2, 0, 0, F, F@_1, TrUserData).
|
||||
|
||||
skip_group_invoke_reply(Bin, _, Z2, FNum, F@_1, TrUserData) ->
|
||||
{_, Rest} = read_group(Bin, FNum),
|
||||
dfp_read_field_def_invoke_reply(Rest, 0, Z2, FNum, F@_1, TrUserData).
|
||||
|
||||
skip_32_invoke_reply(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_invoke_reply(Rest, Z1, Z2, F, F@_1, TrUserData).
|
||||
|
||||
skip_64_invoke_reply(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, TrUserData) -> dfp_read_field_def_invoke_reply(Rest, Z1, Z2, F, F@_1, TrUserData).
|
||||
|
||||
decode_msg_service_config(Bin, TrUserData) -> dfp_read_field_def_service_config(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(0, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_service_config(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_service_config_service_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
@ -1213,40 +1200,6 @@ skip_32_service_config(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUse
|
||||
|
||||
skip_64_service_config(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_service_config(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
|
||||
|
||||
decode_msg_service_config_reply(Bin, TrUserData) -> dfp_read_field_def_service_config_reply(Bin, 0, 0, 0, TrUserData).
|
||||
|
||||
dfp_read_field_def_service_config_reply(<<>>, 0, 0, _, _) -> #service_config_reply{};
|
||||
dfp_read_field_def_service_config_reply(Other, Z1, Z2, F, TrUserData) -> dg_read_field_def_service_config_reply(Other, Z1, Z2, F, TrUserData).
|
||||
|
||||
dg_read_field_def_service_config_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 32 - 7 -> dg_read_field_def_service_config_reply(Rest, N + 7, X bsl N + Acc, F, TrUserData);
|
||||
dg_read_field_def_service_config_reply(<<0:1, X:7, Rest/binary>>, N, Acc, _, TrUserData) ->
|
||||
Key = X bsl N + Acc,
|
||||
case Key band 7 of
|
||||
0 -> skip_varint_service_config_reply(Rest, 0, 0, Key bsr 3, TrUserData);
|
||||
1 -> skip_64_service_config_reply(Rest, 0, 0, Key bsr 3, TrUserData);
|
||||
2 -> skip_length_delimited_service_config_reply(Rest, 0, 0, Key bsr 3, TrUserData);
|
||||
3 -> skip_group_service_config_reply(Rest, 0, 0, Key bsr 3, TrUserData);
|
||||
5 -> skip_32_service_config_reply(Rest, 0, 0, Key bsr 3, TrUserData)
|
||||
end;
|
||||
dg_read_field_def_service_config_reply(<<>>, 0, 0, _, _) -> #service_config_reply{}.
|
||||
|
||||
skip_varint_service_config_reply(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> skip_varint_service_config_reply(Rest, Z1, Z2, F, TrUserData);
|
||||
skip_varint_service_config_reply(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_service_config_reply(Rest, Z1, Z2, F, TrUserData).
|
||||
|
||||
skip_length_delimited_service_config_reply(<<1:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) when N < 57 -> skip_length_delimited_service_config_reply(Rest, N + 7, X bsl N + Acc, F, TrUserData);
|
||||
skip_length_delimited_service_config_reply(<<0:1, X:7, Rest/binary>>, N, Acc, F, TrUserData) ->
|
||||
Length = X bsl N + Acc,
|
||||
<<_:Length/binary, Rest2/binary>> = Rest,
|
||||
dfp_read_field_def_service_config_reply(Rest2, 0, 0, F, TrUserData).
|
||||
|
||||
skip_group_service_config_reply(Bin, _, Z2, FNum, TrUserData) ->
|
||||
{_, Rest} = read_group(Bin, FNum),
|
||||
dfp_read_field_def_service_config_reply(Rest, 0, Z2, FNum, TrUserData).
|
||||
|
||||
skip_32_service_config_reply(<<_:32, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_service_config_reply(Rest, Z1, Z2, F, TrUserData).
|
||||
|
||||
skip_64_service_config_reply(<<_:64, Rest/binary>>, Z1, Z2, F, TrUserData) -> dfp_read_field_def_service_config_reply(Rest, Z1, Z2, F, TrUserData).
|
||||
|
||||
decode_msg_data(Bin, TrUserData) -> dfp_read_field_def_data(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_data(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_data_service_id(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
|
||||
@ -1775,12 +1728,10 @@ merge_msgs(Prev, New, MsgName, Opts) ->
|
||||
auth_request -> merge_msg_auth_request(Prev, New, TrUserData);
|
||||
auth_reply -> merge_msg_auth_reply(Prev, New, TrUserData);
|
||||
pub -> merge_msg_pub(Prev, New, TrUserData);
|
||||
push_reply -> merge_msg_push_reply(Prev, New, TrUserData);
|
||||
deploy -> merge_msg_deploy(Prev, New, TrUserData);
|
||||
deploy_reply -> merge_msg_deploy_reply(Prev, New, TrUserData);
|
||||
invoke -> merge_msg_invoke(Prev, New, TrUserData);
|
||||
invoke_reply -> merge_msg_invoke_reply(Prev, New, TrUserData);
|
||||
service_config -> merge_msg_service_config(Prev, New, TrUserData);
|
||||
service_config_reply -> merge_msg_service_config_reply(Prev, New, TrUserData);
|
||||
data -> merge_msg_data(Prev, New, TrUserData);
|
||||
ping -> merge_msg_ping(Prev, New, TrUserData);
|
||||
service_inform -> merge_msg_service_inform(Prev, New, TrUserData);
|
||||
@ -1833,6 +1784,21 @@ merge_msg_pub(#pub{topic = PFtopic, content = PFcontent}, #pub{topic = NFtopic,
|
||||
true -> NFcontent
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_push_reply/3}).
|
||||
merge_msg_push_reply(#push_reply{code = PFcode, result = PFresult, message = PFmessage}, #push_reply{code = NFcode, result = NFresult, message = NFmessage}, _) ->
|
||||
#push_reply{code =
|
||||
if NFcode =:= undefined -> PFcode;
|
||||
true -> NFcode
|
||||
end,
|
||||
result =
|
||||
if NFresult =:= undefined -> PFresult;
|
||||
true -> NFresult
|
||||
end,
|
||||
message =
|
||||
if NFmessage =:= undefined -> PFmessage;
|
||||
true -> NFmessage
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_deploy/3}).
|
||||
merge_msg_deploy(#deploy{task_id = PFtask_id, service_id = PFservice_id, tar_url = PFtar_url}, #deploy{task_id = NFtask_id, service_id = NFservice_id, tar_url = NFtar_url}, _) ->
|
||||
#deploy{task_id =
|
||||
@ -1848,9 +1814,6 @@ merge_msg_deploy(#deploy{task_id = PFtask_id, service_id = PFservice_id, tar_url
|
||||
true -> NFtar_url
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_deploy_reply/3}).
|
||||
merge_msg_deploy_reply(_Prev, New, _TrUserData) -> New.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_invoke/3}).
|
||||
merge_msg_invoke(#invoke{service_id = PFservice_id, payload = PFpayload}, #invoke{service_id = NFservice_id, payload = NFpayload}, _) ->
|
||||
#invoke{service_id =
|
||||
@ -1862,13 +1825,6 @@ merge_msg_invoke(#invoke{service_id = PFservice_id, payload = PFpayload}, #invok
|
||||
true -> NFpayload
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_invoke_reply/3}).
|
||||
merge_msg_invoke_reply(#invoke_reply{response = PFresponse}, #invoke_reply{response = NFresponse}, _) ->
|
||||
#invoke_reply{response =
|
||||
if NFresponse =:= undefined -> PFresponse;
|
||||
true -> NFresponse
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_service_config/3}).
|
||||
merge_msg_service_config(#service_config{service_id = PFservice_id, config_json = PFconfig_json, timeout = PFtimeout}, #service_config{service_id = NFservice_id, config_json = NFconfig_json, timeout = NFtimeout}, _) ->
|
||||
#service_config{service_id =
|
||||
@ -1884,9 +1840,6 @@ merge_msg_service_config(#service_config{service_id = PFservice_id, config_json
|
||||
true -> NFtimeout
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_service_config_reply/3}).
|
||||
merge_msg_service_config_reply(_Prev, New, _TrUserData) -> New.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_data/3}).
|
||||
merge_msg_data(#data{service_id = PFservice_id, device_uuid = PFdevice_uuid, metric = PFmetric}, #data{service_id = NFservice_id, device_uuid = NFdevice_uuid, metric = NFmetric}, _) ->
|
||||
#data{service_id =
|
||||
@ -2027,12 +1980,10 @@ verify_msg(Msg, MsgName, Opts) ->
|
||||
auth_request -> v_msg_auth_request(Msg, [MsgName], TrUserData);
|
||||
auth_reply -> v_msg_auth_reply(Msg, [MsgName], TrUserData);
|
||||
pub -> v_msg_pub(Msg, [MsgName], TrUserData);
|
||||
push_reply -> v_msg_push_reply(Msg, [MsgName], TrUserData);
|
||||
deploy -> v_msg_deploy(Msg, [MsgName], TrUserData);
|
||||
deploy_reply -> v_msg_deploy_reply(Msg, [MsgName], TrUserData);
|
||||
invoke -> v_msg_invoke(Msg, [MsgName], TrUserData);
|
||||
invoke_reply -> v_msg_invoke_reply(Msg, [MsgName], TrUserData);
|
||||
service_config -> v_msg_service_config(Msg, [MsgName], TrUserData);
|
||||
service_config_reply -> v_msg_service_config_reply(Msg, [MsgName], TrUserData);
|
||||
data -> v_msg_data(Msg, [MsgName], TrUserData);
|
||||
ping -> v_msg_ping(Msg, [MsgName], TrUserData);
|
||||
service_inform -> v_msg_service_inform(Msg, [MsgName], TrUserData);
|
||||
@ -2087,6 +2038,21 @@ v_msg_pub(#pub{topic = F1, content = F2}, Path, TrUserData) ->
|
||||
ok;
|
||||
v_msg_pub(X, Path, _TrUserData) -> mk_type_error({expected_msg, pub}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_push_reply/3}).
|
||||
-dialyzer({nowarn_function,v_msg_push_reply/3}).
|
||||
v_msg_push_reply(#push_reply{code = F1, result = F2, message = F3}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_uint32(F1, [code | Path], TrUserData)
|
||||
end,
|
||||
if F2 == undefined -> ok;
|
||||
true -> v_type_string(F2, [result | Path], TrUserData)
|
||||
end,
|
||||
if F3 == undefined -> ok;
|
||||
true -> v_type_string(F3, [message | Path], TrUserData)
|
||||
end,
|
||||
ok;
|
||||
v_msg_push_reply(X, Path, _TrUserData) -> mk_type_error({expected_msg, push_reply}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_deploy/3}).
|
||||
-dialyzer({nowarn_function,v_msg_deploy/3}).
|
||||
v_msg_deploy(#deploy{task_id = F1, service_id = F2, tar_url = F3}, Path, TrUserData) ->
|
||||
@ -2102,11 +2068,6 @@ v_msg_deploy(#deploy{task_id = F1, service_id = F2, tar_url = F3}, Path, TrUserD
|
||||
ok;
|
||||
v_msg_deploy(X, Path, _TrUserData) -> mk_type_error({expected_msg, deploy}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_deploy_reply/3}).
|
||||
-dialyzer({nowarn_function,v_msg_deploy_reply/3}).
|
||||
v_msg_deploy_reply(#deploy_reply{}, _Path, _) -> ok;
|
||||
v_msg_deploy_reply(X, Path, _TrUserData) -> mk_type_error({expected_msg, deploy_reply}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_invoke/3}).
|
||||
-dialyzer({nowarn_function,v_msg_invoke/3}).
|
||||
v_msg_invoke(#invoke{service_id = F1, payload = F2}, Path, TrUserData) ->
|
||||
@ -2119,15 +2080,6 @@ v_msg_invoke(#invoke{service_id = F1, payload = F2}, Path, TrUserData) ->
|
||||
ok;
|
||||
v_msg_invoke(X, Path, _TrUserData) -> mk_type_error({expected_msg, invoke}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_invoke_reply/3}).
|
||||
-dialyzer({nowarn_function,v_msg_invoke_reply/3}).
|
||||
v_msg_invoke_reply(#invoke_reply{response = F1}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_string(F1, [response | Path], TrUserData)
|
||||
end,
|
||||
ok;
|
||||
v_msg_invoke_reply(X, Path, _TrUserData) -> mk_type_error({expected_msg, invoke_reply}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_service_config/3}).
|
||||
-dialyzer({nowarn_function,v_msg_service_config/3}).
|
||||
v_msg_service_config(#service_config{service_id = F1, config_json = F2, timeout = F3}, Path, TrUserData) ->
|
||||
@ -2143,11 +2095,6 @@ v_msg_service_config(#service_config{service_id = F1, config_json = F2, timeout
|
||||
ok;
|
||||
v_msg_service_config(X, Path, _TrUserData) -> mk_type_error({expected_msg, service_config}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_service_config_reply/3}).
|
||||
-dialyzer({nowarn_function,v_msg_service_config_reply/3}).
|
||||
v_msg_service_config_reply(#service_config_reply{}, _Path, _) -> ok;
|
||||
v_msg_service_config_reply(X, Path, _TrUserData) -> mk_type_error({expected_msg, service_config_reply}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_data/3}).
|
||||
-dialyzer({nowarn_function,v_msg_data/3}).
|
||||
v_msg_data(#data{service_id = F1, device_uuid = F2, metric = F3}, Path, TrUserData) ->
|
||||
@ -2340,18 +2287,19 @@ get_msg_defs() ->
|
||||
#field{name = timestamp, fnum = 6, rnum = 6, type = uint32, occurrence = optional, opts = []}]},
|
||||
{{msg, auth_reply}, [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, pub}, [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = content, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, push_reply},
|
||||
[#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
#field{name = result, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
#field{name = message, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, deploy},
|
||||
[#field{name = task_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
#field{name = service_id, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
#field{name = tar_url, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, deploy_reply}, []},
|
||||
{{msg, invoke}, [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = payload, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, invoke_reply}, [#field{name = response, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, service_config},
|
||||
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
#field{name = config_json, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
#field{name = timeout, fnum = 3, rnum = 4, type = uint32, occurrence = optional, opts = []}]},
|
||||
{{msg, service_config_reply}, []},
|
||||
{{msg, data},
|
||||
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
#field{name = device_uuid, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
@ -2385,13 +2333,13 @@ get_msg_defs() ->
|
||||
#field{name = params, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]}].
|
||||
|
||||
|
||||
get_msg_names() -> [auth_request, auth_reply, pub, deploy, deploy_reply, invoke, invoke_reply, service_config, service_config_reply, data, ping, service_inform, feedback_phase, event].
|
||||
get_msg_names() -> [auth_request, auth_reply, pub, push_reply, deploy, invoke, service_config, data, ping, service_inform, feedback_phase, event].
|
||||
|
||||
|
||||
get_group_names() -> [].
|
||||
|
||||
|
||||
get_msg_or_group_names() -> [auth_request, auth_reply, pub, deploy, deploy_reply, invoke, invoke_reply, service_config, service_config_reply, data, ping, service_inform, feedback_phase, event].
|
||||
get_msg_or_group_names() -> [auth_request, auth_reply, pub, push_reply, deploy, invoke, service_config, data, ping, service_inform, feedback_phase, event].
|
||||
|
||||
|
||||
get_enum_names() -> [].
|
||||
@ -2416,18 +2364,19 @@ find_msg_def(auth_request) ->
|
||||
#field{name = timestamp, fnum = 6, rnum = 6, type = uint32, occurrence = optional, opts = []}];
|
||||
find_msg_def(auth_reply) -> [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def(pub) -> [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = content, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def(push_reply) ->
|
||||
[#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
#field{name = result, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
#field{name = message, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def(deploy) ->
|
||||
[#field{name = task_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
#field{name = service_id, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
#field{name = tar_url, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def(deploy_reply) -> [];
|
||||
find_msg_def(invoke) -> [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = payload, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def(invoke_reply) -> [#field{name = response, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def(service_config) ->
|
||||
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
#field{name = config_json, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
#field{name = timeout, fnum = 3, rnum = 4, type = uint32, occurrence = optional, opts = []}];
|
||||
find_msg_def(service_config_reply) -> [];
|
||||
find_msg_def(data) ->
|
||||
[#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
#field{name = device_uuid, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []},
|
||||
@ -2520,12 +2469,10 @@ service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S
|
||||
fqbin_to_msg_name(<<"AuthRequest">>) -> auth_request;
|
||||
fqbin_to_msg_name(<<"AuthReply">>) -> auth_reply;
|
||||
fqbin_to_msg_name(<<"Pub">>) -> pub;
|
||||
fqbin_to_msg_name(<<"PushReply">>) -> push_reply;
|
||||
fqbin_to_msg_name(<<"Deploy">>) -> deploy;
|
||||
fqbin_to_msg_name(<<"DeployReply">>) -> deploy_reply;
|
||||
fqbin_to_msg_name(<<"Invoke">>) -> invoke;
|
||||
fqbin_to_msg_name(<<"InvokeReply">>) -> invoke_reply;
|
||||
fqbin_to_msg_name(<<"ServiceConfig">>) -> service_config;
|
||||
fqbin_to_msg_name(<<"ServiceConfigReply">>) -> service_config_reply;
|
||||
fqbin_to_msg_name(<<"Data">>) -> data;
|
||||
fqbin_to_msg_name(<<"Ping">>) -> ping;
|
||||
fqbin_to_msg_name(<<"ServiceInform">>) -> service_inform;
|
||||
@ -2537,12 +2484,10 @@ fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}).
|
||||
msg_name_to_fqbin(auth_request) -> <<"AuthRequest">>;
|
||||
msg_name_to_fqbin(auth_reply) -> <<"AuthReply">>;
|
||||
msg_name_to_fqbin(pub) -> <<"Pub">>;
|
||||
msg_name_to_fqbin(push_reply) -> <<"PushReply">>;
|
||||
msg_name_to_fqbin(deploy) -> <<"Deploy">>;
|
||||
msg_name_to_fqbin(deploy_reply) -> <<"DeployReply">>;
|
||||
msg_name_to_fqbin(invoke) -> <<"Invoke">>;
|
||||
msg_name_to_fqbin(invoke_reply) -> <<"InvokeReply">>;
|
||||
msg_name_to_fqbin(service_config) -> <<"ServiceConfig">>;
|
||||
msg_name_to_fqbin(service_config_reply) -> <<"ServiceConfigReply">>;
|
||||
msg_name_to_fqbin(data) -> <<"Data">>;
|
||||
msg_name_to_fqbin(ping) -> <<"Ping">>;
|
||||
msg_name_to_fqbin(service_inform) -> <<"ServiceInform">>;
|
||||
@ -2586,7 +2531,7 @@ get_all_source_basenames() -> ["message_pb.proto"].
|
||||
get_all_proto_names() -> ["message_pb"].
|
||||
|
||||
|
||||
get_msg_containment("message_pb") -> [auth_reply, auth_request, data, deploy, deploy_reply, event, feedback_phase, invoke, invoke_reply, ping, pub, service_config, service_config_reply, service_inform];
|
||||
get_msg_containment("message_pb") -> [auth_reply, auth_request, data, deploy, event, feedback_phase, invoke, ping, pub, push_reply, service_config, service_inform];
|
||||
get_msg_containment(P) -> error({gpb_error, {badproto, P}}).
|
||||
|
||||
|
||||
@ -2614,9 +2559,7 @@ get_proto_by_msg_name_as_fqbin(<<"Invoke">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"FeedbackPhase">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"ServiceConfig">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"Ping">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"ServiceConfigReply">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"InvokeReply">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"DeployReply">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"PushReply">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"Deploy">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"AuthReply">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"ServiceInform">>) -> "message_pb";
|
||||
|
||||
@ -23,6 +23,12 @@ message Pub {
|
||||
|
||||
///// 服务器主动推送的消息
|
||||
|
||||
message PushReply {
|
||||
uint32 code = 1;
|
||||
string result = 2;
|
||||
string message = 3;
|
||||
}
|
||||
|
||||
// 部署逻辑
|
||||
message Deploy {
|
||||
uint32 task_id = 1;
|
||||
@ -30,20 +36,12 @@ message Deploy {
|
||||
string tar_url = 3;
|
||||
}
|
||||
|
||||
message DeployReply {
|
||||
|
||||
}
|
||||
|
||||
// 需要响应; 系统内部的调用采用: $sys_前缀
|
||||
message Invoke {
|
||||
string service_id = 1;
|
||||
string payload = 2;
|
||||
}
|
||||
|
||||
message InvokeReply {
|
||||
string response = 1;
|
||||
}
|
||||
|
||||
// 参数配置
|
||||
message ServiceConfig {
|
||||
string service_id = 1;
|
||||
@ -51,10 +49,6 @@ message ServiceConfig {
|
||||
uint32 timeout = 3;
|
||||
}
|
||||
|
||||
message ServiceConfigReply {
|
||||
|
||||
}
|
||||
|
||||
/////// EFKA主动上报的消息类型
|
||||
|
||||
// 数据传输
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user