Re: [PATCH v4 03/35] pkt-line: add delim packet support
From: Junio C Hamano <hidden>
Date: 2018-03-01 23:43:48
Brandon Williams [off-list ref] writes:
On 03/01, Junio C Hamano wrote: ...quoted
Hmph, strictly speaking, the "delim" does not have to be a part of how packetized stream is defined. As long as we stop abusing flush as "This is merely an end of one segment of what I say." and make it always mean "I am done speaking, it is your turn.", the application payload can define its own syntax to separate groups of packets.Thanks actually a good point. We could just as easily have the delim packet to be an empty packet-line "0004" or something like that.
Yes. As long as there is an easy and obvious "cannot be a value"
constant, you can use it as a delimiter defined at the application
level. For example, your command-request uses delim, like so:
+ request = empty-request | command-request
+ empty-request = flush-pkt
+ command-request = command
+ capability-list
+ (command-args)
+ flush-pkt
+ command = PKT-LINE("command=" key LF)
+ command-args = delim-pkt
+ *PKT-Line(arg LF)
to mark the end of cap list, but if an empty packet does not make
sense as a member of a cap list and a commmand args list, then an
empty packet between cap list and command arg can be used instead.
A protocol-ignorant proxy can still work just fine.
Having a defined delim at the protocol level is often convenient, of
course, but once the application starts calling for multi-level
delimiters (i.e. maybe there are chapters and sections inside each
chapter in a single request message), it would not be sufficient to
define a single delim packet type. The application layer needs to
define its own convention (e.g. if no "empty" section is allowed,
then "two consecutive delim is a chapter break; one delim is a
section break" can become a viable way to emulate multi-level
delimiters).