Hi, Anton,
reviving an old thread; replies inline.
On Mon, Dec 1, 2014 at 3:19 PM, Anton Lavrik <
ala...@piqi.org> wrote:
> On Mon, Dec 1, 2014 at 5:15 AM, Motiejus Jakštys <
desir...@gmail.com>
> wrote:
>>
>> For example, take an obscure use case: you would want to use the same
>> logical interface for external (JSON-HTTP) and internal
>> (PROTOBUF-SCTP) cases. "new" piqi-rpc would be a first-class support
>> only for the former interface, because RPC draft is very HTTP
>> oriented.
>
> Not at all. Why do you think it is?
Because of http-header field in the packet-header record[1]. But I
guess I`m just misunderstanding something.
> I did reuse some of HTTP syntax and semantics in the spec. This is
> convenient and allows us to achieve easy 1-to-1 mapping between
> piqi-rpc-http header (as in the current version) and piqi-rpc abstract
> header. The only non-straightforward part is understanding that HTTP status
> is a combination of piqi-rpc status and piqi-rpc error-code, but there is
> still 1-to-1 correspondence between them.
Is piqi-rpc abstract header you are referring to is this whole record[2]?
> Note that, by definition, there is a 1-to-1 mapping between piqi-rpc-binary
> header and piqi-rpc abstract header, because binary header is just a
> protobuf-serialized abstract header.
If the answer to my question above is yes, then why is
'http-header'[1] in the abstract piqi-rpc packet header?
> Finally, body format is exactly the same across piqi-rpc-binary and
> piqi-rpc-http.
OK.
> Error reporting may depend on protocol, like in case of piqi-rpc-http,
> because we decided to reuse some of HTTP level 7 functions instead of just
> using as a l3 transport. However, HTTP is fairly unique in this respect.
> Using RPC over HTTP is a very practical and natural choice. I can't think of
> any other l7 protocol for which we may want to provide direct mapping.
>
> On the other hand, l3 error reporting is generally pretty useless for
> application purposes. Errors typically boil down to "can't connect",
> "connection lost" or something along these lines. Clients may know better
> how to handle these and stateless RPC servers generally don't care.
I have in mind something I used to work with in the past: each service
exposed two kinds of endpoints:
1. piqi-rpc over HTTP.
2. distributed erlang: {ok | error, Payload :: binary()} for a response.
Distributed Erlang has tuples, lists and binaries, which can have
extra information about the errors, very much like in HTTP (e.g. by
adding another element to the return tuple). To be honest, I don't
think it's a good idea to use that protocol, but it gives a nice L7
example transport to think about.
> Or am I missing something?
I feel like I`m missing the point of [1] in that record. To
reiterate, does that field make sense if I adopt piqi_rpc_v1.piqi for
a "distributed erlang" type of transport?
I feel like I`m misunderstanding something here. Are we even supposed
to be reusing piqi_rpc_v1.piqi for implementing a different kind of
L7 type of transport, like distributed erlang like in the example
above?
Regards,
Motiejus
[1]:
https://github.com/alavrik/piqi/blob/1e6089805b97986c6652d7a260b6645788a0e128/src/piqi_rpc_v1.piqi#L100-L106
[2]:
https://github.com/alavrik/piqi/blob/1e6089805b97986c6652d7a260b6645788a0e128/src/piqi_rpc_v1.piqi#L19