* Update for changes in semantic
This commit is contained in:
Andrew Mayorov 2019-06-06 14:36:19 +03:00 committed by GitHub
parent 7d1cd35957
commit 4d1b63f6b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View File

@ -13,7 +13,7 @@
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2}, {<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2},
{<<"mg_proto">>, {<<"mg_proto">>,
{git,"git@github.com:rbkmoney/machinegun_proto.git", {git,"git@github.com:rbkmoney/machinegun_proto.git",
{ref,"5c07c579014f9900357f7a72f9d10a03008b9da1"}}, {ref,"ebae56fe2b3e79e4eb34afc8cb55c9012ae989f8"}},
0}, 0},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.0.2">>},2}, {<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.0.2">>},2},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3}, {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3},

View File

@ -281,7 +281,7 @@ marshal({event, Schema}, {EventID, CreatedAt, Body}) ->
#mg_stateproc_Event{ #mg_stateproc_Event{
'id' = marshal(event_id, EventID), 'id' = marshal(event_id, EventID),
'created_at' = marshal(timestamp, CreatedAt), 'created_at' = marshal(timestamp, CreatedAt),
'event_payload' = marshal({schema, Schema, event}, Body) 'data' = marshal({schema, Schema, event}, Body)
}; };
marshal({signal, Schema}, {init, Args}) -> marshal({signal, Schema}, {init, Args}) ->
@ -308,10 +308,15 @@ marshal({call_result, Schema}, {Response, #{} = V}) ->
marshal({state_change, Schema}, #{} = V) -> marshal({state_change, Schema}, #{} = V) ->
#mg_stateproc_MachineStateChange{ #mg_stateproc_MachineStateChange{
events = marshal({list, {schema, Schema, event}}, maps:get(events, V, [])), events = [
#mg_stateproc_Content{data = Event}
|| Event <- marshal({list, {schema, Schema, event}}, maps:get(events, V, []))
],
% TODO % TODO
% Provide this to logic handlers as well % Provide this to logic handlers as well
aux_state = marshal({schema, Schema, aux_state}, maps:get(aux_state, V, undefined)) aux_state = #mg_stateproc_Content{
data = marshal({schema, Schema, aux_state}, maps:get(aux_state, V, undefined))
}
}; };
marshal(action, V) when is_list(V) -> marshal(action, V) when is_list(V) ->
@ -427,7 +432,7 @@ unmarshal(
'id' = ID, 'id' = ID,
'history' = History, 'history' = History,
'history_range' = Range, 'history_range' = Range,
'aux_state' = AuxState 'aux_state' = #mg_stateproc_Content{format_version = _Version, data = AuxState}
} }
) -> ) ->
#{ #{
@ -446,7 +451,7 @@ unmarshal(
#mg_stateproc_Event{ #mg_stateproc_Event{
'id' = EventID, 'id' = EventID,
'created_at' = CreatedAt, 'created_at' = CreatedAt,
'event_payload' = Payload 'data' = Payload
} }
) -> ) ->
{unmarshal(event_id, EventID), unmarshal(timestamp, CreatedAt), unmarshal({schema, Schema, event}, Payload)}; {unmarshal(event_id, EventID), unmarshal(timestamp, CreatedAt), unmarshal({schema, Schema, event}, Payload)};