Module: Docker::API::Stream

Defined in:
lib/docker/api/stream.rb

Overview

Decoders for the three wire formats the Engine API streams in.

All three are stateful accumulators, and that is the important part. HTTP hands us chunks at byte boundaries that have nothing to do with Docker's framing: a frame header can be split across two chunks and a JSON object can be split mid-string. A decoder that assumes a chunk is a message passes its tests and then interleaves garbage in production, which is precisely the bug class that makes exec output untrustworthy.

Defined Under Namespace

Classes: Demultiplexer, JSONLines, Raw

Constant Summary collapse

HEADER_SIZE =

Docker's multiplexed frame header is eight bytes: a stream id, three bytes of padding, then a big-endian payload length.

8
STREAM_NAMES =

Stream ids as they appear in the first header byte.

{ 0 => :stdin, 1 => :stdout, 2 => :stderr }.freeze