All projection store protocol operations are now using Protocol Buffers!

So, there's some cheating going on, because some of the parts of
the #projection_v1{} and #p_srvr{} records aren't fully specified.
Those parts are being specified as "opaque" in the field names, e.g.

    optional bytes opaque_flap = 10;
    optional bytes opaque_inner = 11;
    required bytes opaque_dbg = 12;
    required bytes opaque_dbg2 = 13;

The serialization that's being used is erlang term sexprs.  That isn't
portable.  So if/when we really need to deal with a non-Erlang
language, we'll have to straighten this out further.
This commit is contained in:
Scott Lystig Fritchie 2015-06-25 15:26:35 +09:00
parent 841235b3b5
commit 5d8b648a24
3 changed files with 2 additions and 3 deletions

View file

@ -335,7 +335,7 @@ message Mpb_LL_ReadLatestProjectionReq {
message Mpb_LL_ReadLatestProjectionResp { message Mpb_LL_ReadLatestProjectionResp {
required Mpb_GeneralStatusCode status = 1; required Mpb_GeneralStatusCode status = 1;
optional Mpb_ProjectionV1 proj = 1; optional Mpb_ProjectionV1 proj = 2;
} }
// Low level API: read_projection() request & response // Low level API: read_projection() request & response

View file

@ -835,7 +835,6 @@ do_projection_common(Sock, Req) ->
erase(bad_sock), erase(bad_sock),
try try
ReqBin = list_to_binary(machi_pb:encode_mpb_ll_request(Req)), ReqBin = list_to_binary(machi_pb:encode_mpb_ll_request(Req)),
io:format(user, "\nTrying: ~p\n", [machi_pb:decode_mpb_ll_request(ReqBin)]),
Len = iolist_size(ReqBin), Len = iolist_size(ReqBin),
true = (Len =< ?MAX_CHUNK_SIZE), true = (Len =< ?MAX_CHUNK_SIZE),
LenHex = machi_util:int_to_hexbin(Len, 32), LenHex = machi_util:int_to_hexbin(Len, 32),

View file

@ -173,7 +173,7 @@ flu_projection_smoke_test() ->
{ok, []} = ?FLU_C:list_all_projections(Host, TcpPort, T), {ok, []} = ?FLU_C:list_all_projections(Host, TcpPort, T),
{ok, []} = ?FLU_C:get_all_projections(Host, TcpPort, T), {ok, []} = ?FLU_C:get_all_projections(Host, TcpPort, T),
P_a = #p_srvr{name=a, port=4321}, P_a = #p_srvr{name=a, address="localhost", port=4321},
P1 = machi_projection:new(1, a, [P_a], [], [a], [], []), P1 = machi_projection:new(1, a, [P_a], [], [a], [], []),
ok = ?FLU_C:write_projection(Host, TcpPort, T, P1), ok = ?FLU_C:write_projection(Host, TcpPort, T, P1),
{error, written} = ?FLU_C:write_projection(Host, TcpPort, T, P1), {error, written} = ?FLU_C:write_projection(Host, TcpPort, T, P1),