fix
This commit is contained in:
parent
9eba51cc95
commit
6ac46ea81b
@ -53,14 +53,6 @@
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('COMMAND_PB_H').
|
||||
-define('COMMAND_PB_H', true).
|
||||
-record(command,
|
||||
{topic = <<>> :: unicode:chardata() | undefined, % = 1, optional
|
||||
content = <<>> :: unicode:chardata() | undefined % = 2, optional
|
||||
}).
|
||||
-endif.
|
||||
|
||||
-ifndef('ASYNC_REQUEST_PB_H').
|
||||
-define('ASYNC_REQUEST_PB_H', true).
|
||||
-record(async_request,
|
||||
|
||||
@ -65,8 +65,6 @@
|
||||
|
||||
-type pub() :: #pub{}.
|
||||
|
||||
-type command() :: #command{}.
|
||||
|
||||
-type async_request() :: #async_request{}.
|
||||
|
||||
-type async_response() :: #async_response{}.
|
||||
@ -83,9 +81,9 @@
|
||||
|
||||
-type event() :: #event{}.
|
||||
|
||||
-export_type(['auth_request'/0, 'auth_reply'/0, 'deploy'/0, 'efka_response'/0, 'pub'/0, 'command'/0, 'async_request'/0, 'async_response'/0, 'service_config'/0, 'data'/0, 'ping'/0, 'service_inform'/0, 'feedback_phase'/0, 'event'/0]).
|
||||
-type '$msg_name'() :: auth_request | auth_reply | deploy | efka_response | pub | command | async_request | async_response | service_config | data | ping | service_inform | feedback_phase | event.
|
||||
-type '$msg'() :: auth_request() | auth_reply() | deploy() | efka_response() | pub() | command() | async_request() | async_response() | service_config() | data() | ping() | service_inform() | feedback_phase() | event().
|
||||
-export_type(['auth_request'/0, 'auth_reply'/0, 'deploy'/0, 'efka_response'/0, 'pub'/0, 'async_request'/0, 'async_response'/0, 'service_config'/0, 'data'/0, 'ping'/0, 'service_inform'/0, 'feedback_phase'/0, 'event'/0]).
|
||||
-type '$msg_name'() :: auth_request | auth_reply | deploy | efka_response | pub | async_request | async_response | service_config | data | ping | service_inform | feedback_phase | event.
|
||||
-type '$msg'() :: auth_request() | auth_reply() | deploy() | efka_response() | pub() | async_request() | async_response() | service_config() | data() | ping() | service_inform() | feedback_phase() | event().
|
||||
-export_type(['$msg_name'/0, '$msg'/0]).
|
||||
|
||||
-if(?OTP_RELEASE >= 24).
|
||||
@ -117,7 +115,6 @@ encode_msg(Msg, MsgName, Opts) ->
|
||||
deploy -> encode_msg_deploy(id(Msg, TrUserData), TrUserData);
|
||||
efka_response -> encode_msg_efka_response(id(Msg, TrUserData), TrUserData);
|
||||
pub -> encode_msg_pub(id(Msg, TrUserData), TrUserData);
|
||||
command -> encode_msg_command(id(Msg, TrUserData), TrUserData);
|
||||
async_request -> encode_msg_async_request(id(Msg, TrUserData), TrUserData);
|
||||
async_response -> encode_msg_async_response(id(Msg, TrUserData), TrUserData);
|
||||
service_config -> encode_msg_service_config(id(Msg, TrUserData), TrUserData);
|
||||
@ -300,31 +297,6 @@ encode_msg_pub(#pub{topic = F1, content = F2}, Bin, TrUserData) ->
|
||||
end
|
||||
end.
|
||||
|
||||
encode_msg_command(Msg, TrUserData) -> encode_msg_command(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
encode_msg_command(#command{topic = F1, content = F2}, Bin, TrUserData) ->
|
||||
B1 = 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,
|
||||
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.
|
||||
|
||||
encode_msg_async_request(Msg, TrUserData) -> encode_msg_async_request(Msg, <<>>, TrUserData).
|
||||
|
||||
|
||||
@ -857,7 +829,6 @@ decode_msg_2_doit(auth_reply, Bin, TrUserData) -> id(decode_msg_auth_reply(Bin,
|
||||
decode_msg_2_doit(deploy, Bin, TrUserData) -> id(decode_msg_deploy(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(efka_response, Bin, TrUserData) -> id(decode_msg_efka_response(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(pub, Bin, TrUserData) -> id(decode_msg_pub(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(command, Bin, TrUserData) -> id(decode_msg_command(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(async_request, Bin, TrUserData) -> id(decode_msg_async_request(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(async_response, Bin, TrUserData) -> id(decode_msg_async_response(Bin, TrUserData), TrUserData);
|
||||
decode_msg_2_doit(service_config, Bin, TrUserData) -> id(decode_msg_service_config(Bin, TrUserData), TrUserData);
|
||||
@ -1159,57 +1130,6 @@ 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_command(Bin, TrUserData) -> dfp_read_field_def_command(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_command(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_command_topic(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
|
||||
dfp_read_field_def_command(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_command_content(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
|
||||
dfp_read_field_def_command(<<>>, 0, 0, _, F@_1, F@_2, _) -> #command{topic = F@_1, content = F@_2};
|
||||
dfp_read_field_def_command(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_command(Other, Z1, Z2, F, F@_1, F@_2, TrUserData).
|
||||
|
||||
dg_read_field_def_command(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_command(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
dg_read_field_def_command(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) ->
|
||||
Key = X bsl N + Acc,
|
||||
case Key of
|
||||
10 -> d_field_command_topic(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
|
||||
18 -> d_field_command_content(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
|
||||
_ ->
|
||||
case Key band 7 of
|
||||
0 -> skip_varint_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
|
||||
1 -> skip_64_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
|
||||
2 -> skip_length_delimited_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
|
||||
3 -> skip_group_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
|
||||
5 -> skip_32_command(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData)
|
||||
end
|
||||
end;
|
||||
dg_read_field_def_command(<<>>, 0, 0, _, F@_1, F@_2, _) -> #command{topic = F@_1, content = F@_2}.
|
||||
|
||||
d_field_command_topic(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_command_topic(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
d_field_command_topic(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, 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_command(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
|
||||
|
||||
d_field_command_content(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_command_content(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
d_field_command_content(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, 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_command(RestF, 0, 0, F, F@_1, NewFValue, TrUserData).
|
||||
|
||||
skip_varint_command(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
|
||||
skip_varint_command(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
|
||||
|
||||
skip_length_delimited_command(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_command(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
skip_length_delimited_command(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) ->
|
||||
Length = X bsl N + Acc,
|
||||
<<_:Length/binary, Rest2/binary>> = Rest,
|
||||
dfp_read_field_def_command(Rest2, 0, 0, F, F@_1, F@_2, TrUserData).
|
||||
|
||||
skip_group_command(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) ->
|
||||
{_, Rest} = read_group(Bin, FNum),
|
||||
dfp_read_field_def_command(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData).
|
||||
|
||||
skip_32_command(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
|
||||
|
||||
skip_64_command(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_command(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
|
||||
|
||||
decode_msg_async_request(Bin, TrUserData) -> dfp_read_field_def_async_request(Bin, 0, 0, 0, id(<<>>, TrUserData), id(<<>>, TrUserData), TrUserData).
|
||||
|
||||
dfp_read_field_def_async_request(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_async_request_method(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
|
||||
@ -1907,7 +1827,6 @@ merge_msgs(Prev, New, MsgName, Opts) ->
|
||||
deploy -> merge_msg_deploy(Prev, New, TrUserData);
|
||||
efka_response -> merge_msg_efka_response(Prev, New, TrUserData);
|
||||
pub -> merge_msg_pub(Prev, New, TrUserData);
|
||||
command -> merge_msg_command(Prev, New, TrUserData);
|
||||
async_request -> merge_msg_async_request(Prev, New, TrUserData);
|
||||
async_response -> merge_msg_async_response(Prev, New, TrUserData);
|
||||
service_config -> merge_msg_service_config(Prev, New, TrUserData);
|
||||
@ -1993,17 +1912,6 @@ merge_msg_pub(#pub{topic = PFtopic, content = PFcontent}, #pub{topic = NFtopic,
|
||||
true -> NFcontent
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_command/3}).
|
||||
merge_msg_command(#command{topic = PFtopic, content = PFcontent}, #command{topic = NFtopic, content = NFcontent}, _) ->
|
||||
#command{topic =
|
||||
if NFtopic =:= undefined -> PFtopic;
|
||||
true -> NFtopic
|
||||
end,
|
||||
content =
|
||||
if NFcontent =:= undefined -> PFcontent;
|
||||
true -> NFcontent
|
||||
end}.
|
||||
|
||||
-compile({nowarn_unused_function,merge_msg_async_request/3}).
|
||||
merge_msg_async_request(#async_request{method = PFmethod, params = PFparams}, #async_request{method = NFmethod, params = NFparams}, _) ->
|
||||
#async_request{method =
|
||||
@ -2187,7 +2095,6 @@ verify_msg(Msg, MsgName, Opts) ->
|
||||
deploy -> v_msg_deploy(Msg, [MsgName], TrUserData);
|
||||
efka_response -> v_msg_efka_response(Msg, [MsgName], TrUserData);
|
||||
pub -> v_msg_pub(Msg, [MsgName], TrUserData);
|
||||
command -> v_msg_command(Msg, [MsgName], TrUserData);
|
||||
async_request -> v_msg_async_request(Msg, [MsgName], TrUserData);
|
||||
async_response -> v_msg_async_response(Msg, [MsgName], TrUserData);
|
||||
service_config -> v_msg_service_config(Msg, [MsgName], TrUserData);
|
||||
@ -2275,18 +2182,6 @@ 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_command/3}).
|
||||
-dialyzer({nowarn_function,v_msg_command/3}).
|
||||
v_msg_command(#command{topic = F1, content = F2}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_string(F1, [topic | Path], TrUserData)
|
||||
end,
|
||||
if F2 == undefined -> ok;
|
||||
true -> v_type_string(F2, [content | Path], TrUserData)
|
||||
end,
|
||||
ok;
|
||||
v_msg_command(X, Path, _TrUserData) -> mk_type_error({expected_msg, command}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_msg_async_request/3}).
|
||||
-dialyzer({nowarn_function,v_msg_async_request/3}).
|
||||
v_msg_async_request(#async_request{method = F1, params = F2}, Path, TrUserData) ->
|
||||
@ -2529,7 +2424,6 @@ get_msg_defs() ->
|
||||
#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, 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, command}, [#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, async_request}, [#field{name = method, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = params, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, async_response},
|
||||
[#field{name = code, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
@ -2572,13 +2466,13 @@ get_msg_defs() ->
|
||||
#field{name = params, fnum = 3, rnum = 4, type = string, occurrence = optional, opts = []}]}].
|
||||
|
||||
|
||||
get_msg_names() -> [auth_request, auth_reply, deploy, efka_response, pub, command, async_request, async_response, service_config, data, ping, service_inform, feedback_phase, event].
|
||||
get_msg_names() -> [auth_request, auth_reply, deploy, efka_response, pub, async_request, async_response, service_config, data, ping, service_inform, feedback_phase, event].
|
||||
|
||||
|
||||
get_group_names() -> [].
|
||||
|
||||
|
||||
get_msg_or_group_names() -> [auth_request, auth_reply, deploy, efka_response, pub, command, async_request, async_response, service_config, data, ping, service_inform, feedback_phase, event].
|
||||
get_msg_or_group_names() -> [auth_request, auth_reply, deploy, efka_response, pub, async_request, async_response, service_config, data, ping, service_inform, feedback_phase, event].
|
||||
|
||||
|
||||
get_enum_names() -> [].
|
||||
@ -2611,7 +2505,6 @@ find_msg_def(efka_response) ->
|
||||
#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(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(command) -> [#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(async_request) -> [#field{name = method, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}, #field{name = params, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def(async_response) ->
|
||||
[#field{name = code, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []},
|
||||
@ -2715,7 +2608,6 @@ fqbin_to_msg_name(<<"AuthReply">>) -> auth_reply;
|
||||
fqbin_to_msg_name(<<"Deploy">>) -> deploy;
|
||||
fqbin_to_msg_name(<<"EfkaResponse">>) -> efka_response;
|
||||
fqbin_to_msg_name(<<"Pub">>) -> pub;
|
||||
fqbin_to_msg_name(<<"Command">>) -> command;
|
||||
fqbin_to_msg_name(<<"AsyncRequest">>) -> async_request;
|
||||
fqbin_to_msg_name(<<"AsyncResponse">>) -> async_response;
|
||||
fqbin_to_msg_name(<<"ServiceConfig">>) -> service_config;
|
||||
@ -2732,7 +2624,6 @@ msg_name_to_fqbin(auth_reply) -> <<"AuthReply">>;
|
||||
msg_name_to_fqbin(deploy) -> <<"Deploy">>;
|
||||
msg_name_to_fqbin(efka_response) -> <<"EfkaResponse">>;
|
||||
msg_name_to_fqbin(pub) -> <<"Pub">>;
|
||||
msg_name_to_fqbin(command) -> <<"Command">>;
|
||||
msg_name_to_fqbin(async_request) -> <<"AsyncRequest">>;
|
||||
msg_name_to_fqbin(async_response) -> <<"AsyncResponse">>;
|
||||
msg_name_to_fqbin(service_config) -> <<"ServiceConfig">>;
|
||||
@ -2779,7 +2670,7 @@ get_all_source_basenames() -> ["message_pb.proto"].
|
||||
get_all_proto_names() -> ["message_pb"].
|
||||
|
||||
|
||||
get_msg_containment("message_pb") -> [async_request, async_response, auth_reply, auth_request, command, data, deploy, efka_response, event, feedback_phase, ping, pub, service_config, service_inform];
|
||||
get_msg_containment("message_pb") -> [async_request, async_response, auth_reply, auth_request, data, deploy, efka_response, event, feedback_phase, ping, pub, service_config, service_inform];
|
||||
get_msg_containment(P) -> error({gpb_error, {badproto, P}}).
|
||||
|
||||
|
||||
@ -2802,7 +2693,6 @@ get_enum_containment(P) -> error({gpb_error, {badproto, P}}).
|
||||
get_proto_by_msg_name_as_fqbin(<<"Data">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"Pub">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"Event">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"Command">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"AuthRequest">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"AsyncRequest">>) -> "message_pb";
|
||||
get_proto_by_msg_name_as_fqbin(<<"FeedbackPhase">>) -> "message_pb";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user