fix packetId
This commit is contained in:
parent
939f3bc1d7
commit
dad124edb1
@ -20,7 +20,7 @@
|
||||
-ifndef('REQUEST_PB_H').
|
||||
-define('REQUEST_PB_H', true).
|
||||
-record('Request',
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 64 bits
|
||||
body :: {auth_request, message_pb:'Request.AuthRequest'()} | undefined % oneof
|
||||
}).
|
||||
-endif.
|
||||
@ -43,7 +43,7 @@
|
||||
-ifndef('RESPONSE_PB_H').
|
||||
-define('RESPONSE_PB_H', true).
|
||||
-record('Response',
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 64 bits
|
||||
body :: {auth_response, message_pb:'Response.AuthResponse'()} | {error, message_pb:'Response.Error'()} | undefined % oneof
|
||||
}).
|
||||
-endif.
|
||||
@ -121,7 +121,7 @@
|
||||
-ifndef('COMMAND_PB_H').
|
||||
-define('COMMAND_PB_H', true).
|
||||
-record('Command',
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 64 bits
|
||||
body :: {container, message_pb:'Command.Container'()} | undefined % oneof
|
||||
}).
|
||||
-endif.
|
||||
@ -137,7 +137,7 @@
|
||||
-ifndef('COMMANDRESPONSE_PB_H').
|
||||
-define('COMMANDRESPONSE_PB_H', true).
|
||||
-record('CommandResponse',
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 64 bits
|
||||
body :: {result, iodata()} | {error, message_pb:'CommandResponse.Error'()} | undefined % oneof
|
||||
}).
|
||||
-endif.
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
-ifndef('SERVICEREQUEST_PB_H').
|
||||
-define('SERVICEREQUEST_PB_H', true).
|
||||
-record('ServiceRequest',
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 64 bits
|
||||
request :: {register, service_pb:'ServiceRequest.Register'()} | {subscribe, service_pb:'ServiceRequest.Subscribe'()} | undefined % oneof
|
||||
}).
|
||||
-endif.
|
||||
@ -41,7 +41,7 @@
|
||||
-ifndef('SERVICEREPLY_PB_H').
|
||||
-define('SERVICEREPLY_PB_H', true).
|
||||
-record('ServiceReply',
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 32 bits
|
||||
{packet_id = 0 :: non_neg_integer() | undefined, % = 1, optional, 64 bits
|
||||
reply :: {result, iodata()} | {error, service_pb:'ServiceReply.Error'()} | undefined % oneof
|
||||
}).
|
||||
-endif.
|
||||
|
||||
@ -14,7 +14,7 @@ syntax = "proto3";
|
||||
// HTTP proxy bytes carried by Stream.Data are transparent payload bytes.
|
||||
|
||||
message Request {
|
||||
uint32 packet_id = 1;
|
||||
uint64 packet_id = 1;
|
||||
|
||||
message AuthRequest {
|
||||
bytes uuid = 1;
|
||||
@ -29,7 +29,7 @@ message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
uint32 packet_id = 1;
|
||||
uint64 packet_id = 1;
|
||||
|
||||
message Error {
|
||||
uint32 code = 1;
|
||||
@ -48,7 +48,7 @@ message Response {
|
||||
}
|
||||
|
||||
message Command {
|
||||
uint32 packet_id = 1;
|
||||
uint64 packet_id = 1;
|
||||
|
||||
message Container {
|
||||
message ContainerTarget {
|
||||
@ -111,7 +111,7 @@ message Command {
|
||||
}
|
||||
|
||||
message CommandResponse {
|
||||
uint32 packet_id = 1;
|
||||
uint64 packet_id = 1;
|
||||
|
||||
message Error {
|
||||
uint32 code = 1;
|
||||
@ -190,4 +190,4 @@ message Stream {
|
||||
Fin fin = 14;
|
||||
Reset reset = 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ syntax = "proto3";
|
||||
// 该协议用于替代当前基于 JSON 的请求/响应/推送格式。
|
||||
|
||||
message ServiceRequest {
|
||||
uint32 packet_id = 1;
|
||||
uint64 packet_id = 1;
|
||||
|
||||
message Register {
|
||||
string service_id = 1;
|
||||
@ -21,7 +21,7 @@ message ServiceRequest {
|
||||
}
|
||||
|
||||
message ServiceReply {
|
||||
uint32 packet_id = 1;
|
||||
uint64 packet_id = 1;
|
||||
|
||||
message Error {
|
||||
int32 code = 1;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
{gpb_opts, [
|
||||
{i, "proto"},
|
||||
{f, ["service.proto"]},
|
||||
{f, ["service.proto", "message.proto"]},
|
||||
recursive,
|
||||
{module_name_prefix, ""},
|
||||
{module_name_suffix, "_pb"},
|
||||
|
||||
@ -392,16 +392,13 @@ auth_packet(Ref) when is_integer(Ref), Ref > 0 ->
|
||||
encode_message_frame(ping) ->
|
||||
encode_transport_frame(?CLASS_MESSAGE, #'Message'{body = {ping, #'Message.Ping'{}}});
|
||||
encode_message_frame({metric_data, RouteKey, Metric}) ->
|
||||
encode_transport_frame(?CLASS_MESSAGE, #'Message'{body = {metric_data, #'Message.MetricData'{
|
||||
route_key = RouteKey,
|
||||
metric = Metric
|
||||
}}});
|
||||
encode_transport_frame(?CLASS_MESSAGE, #'Message'{
|
||||
body = {metric_data, #'Message.MetricData'{route_key = RouteKey, metric = Metric}}
|
||||
});
|
||||
encode_message_frame({task_event, TaskId, Type, Stream}) ->
|
||||
encode_transport_frame(?CLASS_MESSAGE, #'Message'{body = {task_event, #'Message.TaskEvent'{
|
||||
task_id = TaskId,
|
||||
type = Type,
|
||||
stream = Stream
|
||||
}}});
|
||||
encode_transport_frame(?CLASS_MESSAGE, #'Message'{
|
||||
body = {task_event, #'Message.TaskEvent'{task_id = TaskId, type = Type, stream = Stream}}
|
||||
});
|
||||
encode_message_frame(Body) ->
|
||||
error({unsupported_message_body, Body}).
|
||||
|
||||
@ -457,13 +454,7 @@ decode_pb_frame(Payload, MsgName) ->
|
||||
|
||||
-spec next_packet_id(#state{}) -> {pos_integer(), #state{}}.
|
||||
next_packet_id(State = #state{next_pkt_id = PacketId}) ->
|
||||
{PacketId, State#state{next_pkt_id = next_packet_id_value(PacketId)}}.
|
||||
|
||||
-spec next_packet_id_value(pos_integer()) -> pos_integer().
|
||||
next_packet_id_value(16#ffffffff) ->
|
||||
1;
|
||||
next_packet_id_value(PacketId) when is_integer(PacketId), PacketId > 0 ->
|
||||
PacketId + 1.
|
||||
{PacketId, State#state{next_pkt_id = PacketId + 1}}.
|
||||
|
||||
-spec connect_socket() -> {ok, ssl:sslsocket()} | {error, term()}.
|
||||
connect_socket() ->
|
||||
|
||||
@ -1067,7 +1067,7 @@ dg_read_field_def_Request(<<>>, 0, 0, _, F@_1, F@_2, _) -> #'Request'{packet_id
|
||||
|
||||
d_field_Request_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Request_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
d_field_Request_packet_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) ->
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest},
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest},
|
||||
dfp_read_field_def_Request(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
|
||||
|
||||
d_field_Request_auth_request(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Request_auth_request(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
@ -1215,7 +1215,7 @@ dg_read_field_def_Response(<<>>, 0, 0, _, F@_1, F@_2, _) -> #'Response'{packet_i
|
||||
|
||||
d_field_Response_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Response_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
d_field_Response_packet_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) ->
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest},
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest},
|
||||
dfp_read_field_def_Response(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
|
||||
|
||||
d_field_Response_auth_response(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Response_auth_response(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
@ -1874,7 +1874,7 @@ dg_read_field_def_Command(<<>>, 0, 0, _, F@_1, F@_2, _) -> #'Command'{packet_id
|
||||
|
||||
d_field_Command_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Command_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
d_field_Command_packet_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) ->
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest},
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest},
|
||||
dfp_read_field_def_Command(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
|
||||
|
||||
d_field_Command_container(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Command_container(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
@ -1988,7 +1988,7 @@ dg_read_field_def_CommandResponse(<<>>, 0, 0, _, F@_1, F@_2, _) -> #'CommandResp
|
||||
|
||||
d_field_CommandResponse_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_CommandResponse_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
d_field_CommandResponse_packet_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) ->
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest},
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest},
|
||||
dfp_read_field_def_CommandResponse(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
|
||||
|
||||
d_field_CommandResponse_result(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_CommandResponse_result(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
@ -3228,7 +3228,7 @@ verify_msg(Msg, MsgName, Opts) ->
|
||||
-dialyzer({nowarn_function,v_msg_Request/3}).
|
||||
v_msg_Request(#'Request'{packet_id = F1, body = F2}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_uint32(F1, [packet_id | Path], TrUserData)
|
||||
true -> v_type_uint64(F1, [packet_id | Path], TrUserData)
|
||||
end,
|
||||
case F2 of
|
||||
undefined -> ok;
|
||||
@ -3267,7 +3267,7 @@ v_msg_Request(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Request'},
|
||||
-dialyzer({nowarn_function,v_msg_Response/3}).
|
||||
v_msg_Response(#'Response'{packet_id = F1, body = F2}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_uint32(F1, [packet_id | Path], TrUserData)
|
||||
true -> v_type_uint64(F1, [packet_id | Path], TrUserData)
|
||||
end,
|
||||
case F2 of
|
||||
undefined -> ok;
|
||||
@ -3424,7 +3424,7 @@ v_msg_Response(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Response'}
|
||||
-dialyzer({nowarn_function,v_msg_Command/3}).
|
||||
v_msg_Command(#'Command'{packet_id = F1, body = F2}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_uint32(F1, [packet_id | Path], TrUserData)
|
||||
true -> v_type_uint64(F1, [packet_id | Path], TrUserData)
|
||||
end,
|
||||
case F2 of
|
||||
undefined -> ok;
|
||||
@ -3454,7 +3454,7 @@ v_msg_Command(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Command'},
|
||||
-dialyzer({nowarn_function,v_msg_CommandResponse/3}).
|
||||
v_msg_CommandResponse(#'CommandResponse'{packet_id = F1, body = F2}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_uint32(F1, [packet_id | Path], TrUserData)
|
||||
true -> v_type_uint64(F1, [packet_id | Path], TrUserData)
|
||||
end,
|
||||
case F2 of
|
||||
undefined -> ok;
|
||||
@ -3706,12 +3706,12 @@ get_msg_defs() ->
|
||||
#field{name = token, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []},
|
||||
#field{name = timestamp, fnum = 3, rnum = 4, type = uint64, occurrence = optional, opts = []}]},
|
||||
{{msg, 'Request'},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = body, rnum = 3, fields = [#field{name = auth_request, fnum = 10, rnum = 3, type = {msg, 'Request.AuthRequest'}, occurrence = optional, opts = []}], opts = []}]},
|
||||
{{msg, 'Response.Error'}, [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = reason, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]},
|
||||
{{msg, 'Response.AuthResponse'}, []},
|
||||
{{msg, 'Response'},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = body, rnum = 3,
|
||||
fields = [#field{name = auth_response, fnum = 10, rnum = 3, type = {msg, 'Response.AuthResponse'}, occurrence = optional, opts = []}, #field{name = error, fnum = 11, rnum = 3, type = {msg, 'Response.Error'}, occurrence = optional, opts = []}],
|
||||
opts = []}]},
|
||||
@ -3741,11 +3741,11 @@ get_msg_defs() ->
|
||||
{{msg, 'Command.Container.ContainerList'}, []},
|
||||
{{msg, 'Command.Container.ContainerTarget'}, [#field{name = name, fnum = 1, rnum = 2, type = bytes, occurrence = optional, opts = []}, #field{name = id, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]},
|
||||
{{msg, 'Command'},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = body, rnum = 3, fields = [#field{name = container, fnum = 10, rnum = 3, type = {msg, 'Command.Container'}, occurrence = optional, opts = []}], opts = []}]},
|
||||
{{msg, 'CommandResponse.Error'}, [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = reason, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]},
|
||||
{{msg, 'CommandResponse'},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = body, rnum = 3,
|
||||
fields = [#field{name = result, fnum = 10, rnum = 3, type = bytes, occurrence = optional, opts = []}, #field{name = error, fnum = 11, rnum = 3, type = {msg, 'CommandResponse.Error'}, occurrence = optional, opts = []}], opts = []}]},
|
||||
{{msg, 'Message.Ping'}, []},
|
||||
@ -3875,12 +3875,12 @@ find_msg_def('Request.AuthRequest') ->
|
||||
#field{name = token, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []},
|
||||
#field{name = timestamp, fnum = 3, rnum = 4, type = uint64, occurrence = optional, opts = []}];
|
||||
find_msg_def('Request') ->
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = body, rnum = 3, fields = [#field{name = auth_request, fnum = 10, rnum = 3, type = {msg, 'Request.AuthRequest'}, occurrence = optional, opts = []}], opts = []}];
|
||||
find_msg_def('Response.Error') -> [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = reason, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}];
|
||||
find_msg_def('Response.AuthResponse') -> [];
|
||||
find_msg_def('Response') ->
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = body, rnum = 3,
|
||||
fields = [#field{name = auth_response, fnum = 10, rnum = 3, type = {msg, 'Response.AuthResponse'}, occurrence = optional, opts = []}, #field{name = error, fnum = 11, rnum = 3, type = {msg, 'Response.Error'}, occurrence = optional, opts = []}],
|
||||
opts = []}];
|
||||
@ -3910,11 +3910,11 @@ find_msg_def('Command.Container.ContainerDeploy') -> [#field{name = task_id, fnu
|
||||
find_msg_def('Command.Container.ContainerList') -> [];
|
||||
find_msg_def('Command.Container.ContainerTarget') -> [#field{name = name, fnum = 1, rnum = 2, type = bytes, occurrence = optional, opts = []}, #field{name = id, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}];
|
||||
find_msg_def('Command') ->
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = body, rnum = 3, fields = [#field{name = container, fnum = 10, rnum = 3, type = {msg, 'Command.Container'}, occurrence = optional, opts = []}], opts = []}];
|
||||
find_msg_def('CommandResponse.Error') -> [#field{name = code, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []}, #field{name = reason, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}];
|
||||
find_msg_def('CommandResponse') ->
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = body, rnum = 3,
|
||||
fields = [#field{name = result, fnum = 10, rnum = 3, type = bytes, occurrence = optional, opts = []}, #field{name = error, fnum = 11, rnum = 3, type = {msg, 'CommandResponse.Error'}, occurrence = optional, opts = []}], opts = []}];
|
||||
find_msg_def('Message.Ping') -> [];
|
||||
|
||||
@ -558,7 +558,7 @@ dg_read_field_def_ServiceRequest(<<>>, 0, 0, _, F@_1, F@_2, _) -> #'ServiceReque
|
||||
|
||||
d_field_ServiceRequest_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_ServiceRequest_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
d_field_ServiceRequest_packet_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) ->
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest},
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest},
|
||||
dfp_read_field_def_ServiceRequest(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
|
||||
|
||||
d_field_ServiceRequest_register(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_ServiceRequest_register(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
@ -687,7 +687,7 @@ dg_read_field_def_ServiceReply(<<>>, 0, 0, _, F@_1, F@_2, _) -> #'ServiceReply'{
|
||||
|
||||
d_field_ServiceReply_packet_id(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_ServiceReply_packet_id(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
d_field_ServiceReply_packet_id(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) ->
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 4294967295, TrUserData), Rest},
|
||||
{NewFValue, RestF} = {id((X bsl N + Acc) band 18446744073709551615, TrUserData), Rest},
|
||||
dfp_read_field_def_ServiceReply(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
|
||||
|
||||
d_field_ServiceReply_result(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_ServiceReply_result(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
|
||||
@ -1111,7 +1111,7 @@ verify_msg(Msg, MsgName, Opts) ->
|
||||
-dialyzer({nowarn_function,v_msg_ServiceRequest/3}).
|
||||
v_msg_ServiceRequest(#'ServiceRequest'{packet_id = F1, request = F2}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_uint32(F1, [packet_id | Path], TrUserData)
|
||||
true -> v_type_uint64(F1, [packet_id | Path], TrUserData)
|
||||
end,
|
||||
case F2 of
|
||||
undefined -> ok;
|
||||
@ -1142,7 +1142,7 @@ v_msg_ServiceRequest(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Serv
|
||||
-dialyzer({nowarn_function,v_msg_ServiceReply/3}).
|
||||
v_msg_ServiceReply(#'ServiceReply'{packet_id = F1, reply = F2}, Path, TrUserData) ->
|
||||
if F1 == undefined -> ok;
|
||||
true -> v_type_uint32(F1, [packet_id | Path], TrUserData)
|
||||
true -> v_type_uint64(F1, [packet_id | Path], TrUserData)
|
||||
end,
|
||||
case F2 of
|
||||
undefined -> ok;
|
||||
@ -1203,11 +1203,11 @@ v_type_int32(N, _Path, _TrUserData) when is_integer(N), -2147483648 =< N, N =< 2
|
||||
v_type_int32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int32, signed, 32}, N, Path);
|
||||
v_type_int32(X, Path, _TrUserData) -> mk_type_error({bad_integer, int32, signed, 32}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_type_uint32/3}).
|
||||
-dialyzer({nowarn_function,v_type_uint32/3}).
|
||||
v_type_uint32(N, _Path, _TrUserData) when is_integer(N), 0 =< N, N =< 4294967295 -> ok;
|
||||
v_type_uint32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint32, unsigned, 32}, N, Path);
|
||||
v_type_uint32(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint32, unsigned, 32}, X, Path).
|
||||
-compile({nowarn_unused_function,v_type_uint64/3}).
|
||||
-dialyzer({nowarn_function,v_type_uint64/3}).
|
||||
v_type_uint64(N, _Path, _TrUserData) when is_integer(N), 0 =< N, N =< 18446744073709551615 -> ok;
|
||||
v_type_uint64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, uint64, unsigned, 64}, N, Path);
|
||||
v_type_uint64(X, Path, _TrUserData) -> mk_type_error({bad_integer, uint64, unsigned, 64}, X, Path).
|
||||
|
||||
-compile({nowarn_unused_function,v_type_string/3}).
|
||||
-dialyzer({nowarn_function,v_type_string/3}).
|
||||
@ -1267,14 +1267,14 @@ get_msg_defs() ->
|
||||
[{{msg, 'ServiceRequest.Register'}, [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, 'ServiceRequest.Subscribe'}, [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, 'ServiceRequest'},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = request, rnum = 3,
|
||||
fields =
|
||||
[#field{name = register, fnum = 10, rnum = 3, type = {msg, 'ServiceRequest.Register'}, occurrence = optional, opts = []}, #field{name = subscribe, fnum = 11, rnum = 3, type = {msg, 'ServiceRequest.Subscribe'}, occurrence = optional, opts = []}],
|
||||
opts = []}]},
|
||||
{{msg, 'ServiceReply.Error'}, [#field{name = code, fnum = 1, rnum = 2, type = int32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}]},
|
||||
{{msg, 'ServiceReply'},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = reply, rnum = 3, fields = [#field{name = result, fnum = 10, rnum = 3, type = bytes, occurrence = optional, opts = []}, #field{name = error, fnum = 11, rnum = 3, type = {msg, 'ServiceReply.Error'}, occurrence = optional, opts = []}],
|
||||
opts = []}]},
|
||||
{{msg, 'ServiceCast.MetricData'}, [#field{name = route_key, fnum = 1, rnum = 2, type = bytes, occurrence = optional, opts = []}, #field{name = metric, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}]},
|
||||
@ -1312,14 +1312,14 @@ fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}).
|
||||
find_msg_def('ServiceRequest.Register') -> [#field{name = service_id, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def('ServiceRequest.Subscribe') -> [#field{name = topic, fnum = 1, rnum = 2, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def('ServiceRequest') ->
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = request, rnum = 3,
|
||||
fields =
|
||||
[#field{name = register, fnum = 10, rnum = 3, type = {msg, 'ServiceRequest.Register'}, occurrence = optional, opts = []}, #field{name = subscribe, fnum = 11, rnum = 3, type = {msg, 'ServiceRequest.Subscribe'}, occurrence = optional, opts = []}],
|
||||
opts = []}];
|
||||
find_msg_def('ServiceReply.Error') -> [#field{name = code, fnum = 1, rnum = 2, type = int32, occurrence = optional, opts = []}, #field{name = message, fnum = 2, rnum = 3, type = string, occurrence = optional, opts = []}];
|
||||
find_msg_def('ServiceReply') ->
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint32, occurrence = optional, opts = []},
|
||||
[#field{name = packet_id, fnum = 1, rnum = 2, type = uint64, occurrence = optional, opts = []},
|
||||
#gpb_oneof{name = reply, rnum = 3, fields = [#field{name = result, fnum = 10, rnum = 3, type = bytes, occurrence = optional, opts = []}, #field{name = error, fnum = 11, rnum = 3, type = {msg, 'ServiceReply.Error'}, occurrence = optional, opts = []}],
|
||||
opts = []}];
|
||||
find_msg_def('ServiceCast.MetricData') -> [#field{name = route_key, fnum = 1, rnum = 2, type = bytes, occurrence = optional, opts = []}, #field{name = metric, fnum = 2, rnum = 3, type = bytes, occurrence = optional, opts = []}];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user