* 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},
{<<"mg_proto">>,
{git,"git@github.com:rbkmoney/machinegun_proto.git",
{ref,"5c07c579014f9900357f7a72f9d10a03008b9da1"}},
{ref,"ebae56fe2b3e79e4eb34afc8cb55c9012ae989f8"}},
0},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.0.2">>},2},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.0">>},3},

View File

@ -279,9 +279,9 @@ marshal({history, Schema}, V) ->
marshal({list, {event, Schema}}, V);
marshal({event, Schema}, {EventID, CreatedAt, Body}) ->
#mg_stateproc_Event{
'id' = marshal(event_id, EventID),
'created_at' = marshal(timestamp, CreatedAt),
'event_payload' = marshal({schema, Schema, event}, Body)
'id' = marshal(event_id, EventID),
'created_at' = marshal(timestamp, CreatedAt),
'data' = marshal({schema, Schema, event}, Body)
};
marshal({signal, Schema}, {init, Args}) ->
@ -308,10 +308,15 @@ marshal({call_result, Schema}, {Response, #{} = V}) ->
marshal({state_change, Schema}, #{} = V) ->
#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
% 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) ->
@ -427,7 +432,7 @@ unmarshal(
'id' = ID,
'history' = History,
'history_range' = Range,
'aux_state' = AuxState
'aux_state' = #mg_stateproc_Content{format_version = _Version, data = AuxState}
}
) ->
#{
@ -444,9 +449,9 @@ unmarshal({history, Schema}, V) ->
unmarshal(
{event, Schema},
#mg_stateproc_Event{
'id' = EventID,
'created_at' = CreatedAt,
'event_payload' = Payload
'id' = EventID,
'created_at' = CreatedAt,
'data' = Payload
}
) ->
{unmarshal(event_id, EventID), unmarshal(timestamp, CreatedAt), unmarshal({schema, Schema, event}, Payload)};