This is an archive of the discontinued Mercurial Phabricator instance.

wireprotov2: define and use stream encoders
ClosedPublic

Authored by indygreg on Oct 8 2018, 8:29 PM.

Details

Summary

Now that we have basic support for defining stream encoding, it is
time to start doing something with it.

We define various classes implementing stream encoders/decoders for
the defined encoding profiles. This is relatively straightforward.

We teach the inputstream and outputstream classes how to encode,
decode, and flush data.

We then teach the clientreactor how to filter received data through
the inputstream decoder.

One of the features of the framing format is that streams can span
requests. This is a differentiating feature from say HTTP/2, which
associates streams with requests. By allowing streams to span requests,
we can reuse compression context data across requests/responses. But
in order to do this, we need a mechanism to "flush" the encoder at
logical boundaries so that receivers receive all data where it is
expected. And a "flush" event is distinct from a "finish" event from
the perspective of certain compressors because a "flush" will retain
compression context state whereas a "finish" operation will not. This
is why encoders have both a flush() and a finish() and each uses
specific flushing semantics on the underlying compressor.

The added tests verify various behavior of decoders via clientreactor.
These tests do test some compression behavior via use of outputstream.
But for all intents and purposes, server reactor support for encoding
is not yet implemented.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Oct 8 2018, 8:29 PM
This revision was automatically updated to reflect the committed changes.