|
84 | 84 | | {static_update_objects, {Clock :: binary(), Properties :: list(), Updates :: [update()]}}
|
85 | 85 | | {static_read_objects, {Clock :: binary(), Properties :: list(), Objects :: [bound_object()]}}
|
86 | 86 | | {read_objects, {Objects :: [bound_object()], TxId :: binary()}}
|
87 |
| -| {get_connection_descriptor, {}}. |
| 87 | +| {get_connection_descriptor, Descriptor :: binary()}. |
88 | 88 |
|
89 | 89 | -type response() ::
|
90 | 90 | {error_response, {ErrorCode :: error_code(), Message :: binary()}}
|
91 |
| -| {start_transaction_response, Resp :: {ok, TxId :: binary()}} |
| 91 | +| {start_transaction_response, {ok, TxId :: binary()}} |
92 | 92 | | {commit_response, {ok, CommitTime :: any()}| {error, Reason :: error_code()}}
|
93 | 93 | | {static_read_objects_response, {ok, Results :: [{bound_object(), read_result()}], CommitTime :: binary()}}
|
94 | 94 | | {read_objects_response, Resp :: [{bound_object(), read_result()}]}
|
95 | 95 | | {operation_response, ok | {error, Reason :: error_code()}}
|
96 |
| -| {get_connection_descriptor_resp, {ok, Descriptor :: any()} | {error, Reason :: error_code()}}. |
| 96 | +| {get_connection_descriptor_resp, {ok, Descriptor :: binary()} | {error, Reason :: error_code()}}. |
97 | 97 |
|
98 | 98 | -type message() :: request() | response().
|
99 | 99 |
|
100 | 100 |
|
101 |
| - |
102 |
| - |
103 | 101 | messageTypeToCode('ApbErrorResp') -> 0;
|
104 | 102 | messageTypeToCode('ApbRegUpdate') -> 107;
|
105 | 103 | messageTypeToCode('ApbGetRegResp') -> 108;
|
@@ -216,6 +214,16 @@ decode_message(#'ApbStaticReadObjects'{objects = Objects, transaction = Tx}) ->
|
216 | 214 | decode_message(#'ApbReadObjects'{boundobjects = Objects, transaction_descriptor = TxId}) ->
|
217 | 215 | {read_objects, {[decode_bound_object(O) || O <- Objects], binary_to_term(TxId)}};
|
218 | 216 |
|
| 217 | +decode_message(#'ApbCreateDC'{nodes = Nodes}) -> |
| 218 | + {create_dc, [list_to_atom(N) || N <- Nodes]}; |
| 219 | +decode_message(#'ApbGetConnectionDescriptor'{}) -> |
| 220 | + {get_connection_descriptor}; |
| 221 | +decode_message(#'ApbGetConnectionDescriptorResp'{descriptor = Descriptor}) -> |
| 222 | + {get_connection_descriptor, Descriptor}; |
| 223 | +decode_message(#'ApbConnectToDCs'{descriptors = Descriptors}) -> |
| 224 | + {connect_to_dcs, [binary_to_term(D) || D <- Descriptors]}; |
| 225 | + |
| 226 | + |
219 | 227 | decode_message(#'ApbErrorResp'{errcode = ErrorCode, errmsg = Message}) ->
|
220 | 228 | {error_response, {decode_error_code(ErrorCode), Message}};
|
221 | 229 | decode_message(#'ApbStartTransactionResp'{success = Success, transaction_descriptor = TxId, errorcode = ErrorCode}) ->
|
@@ -372,7 +380,8 @@ encode_txn_properties(_Props) ->
|
372 | 380 | #'ApbTxnProperties'{}.
|
373 | 381 |
|
374 | 382 | decode_txn_properties(_Properties) ->
|
375 |
| - {}. |
| 383 | + %%TODO: Add more property parameters |
| 384 | + []. |
376 | 385 |
|
377 | 386 |
|
378 | 387 | %%%%%%%%%%%%%%%%%%%%%
|
@@ -813,7 +822,7 @@ decode_connect_to_DCs(#'ApbConnectToDCs'{descriptors = Descriptors}) ->
|
813 | 822 | %% Tests encode and decode
|
814 | 823 | start_transaction_test() ->
|
815 | 824 | Clock = term_to_binary(ignore),
|
816 |
| - Properties = {}, |
| 825 | + Properties = [], |
817 | 826 | EncRecord = antidote_pb_codec:encode(start_transaction,
|
818 | 827 | {Clock, Properties}),
|
819 | 828 | [MsgCode, MsgData] = encode_msg(EncRecord),
|
|
0 commit comments