Documentation
¶
Overview ¶
Package wire carries the sync endpoint protocol over one exec stream: length- prefixed protobuf frames, request/response, one request in flight.
One request in flight governs requests, not frames. A request that carries a body is followed by chunk frames terminated by an eof chunk, which is what lets content stream rather than be buffered whole — the endpoint shares the container's cgroup and cannot afford to hold a file in memory.
Index ¶
- Constants
- Variables
- type Conn
- func (c *Conn) DiscardBody() error
- func (c *Conn) ReadBody(dst io.Writer, limit int64) error
- func (c *Conn) ReadFrame() (*syncv1.Frame, error)
- func (c *Conn) WriteBody(src io.Reader, limit int64) error
- func (c *Conn) WriteFrame(frame *syncv1.Frame) error
- func (c *Conn) WriteRequest(request *syncv1.Request) error
- func (c *Conn) WriteResponse(response *syncv1.Response) error
Constants ¶
const ( // ChunkSize is the body chunk. Matches the file upload chunk the CLI // already uses. ChunkSize = 64 << 10 // MaxFrameSize bounds a single frame. Bodies are chunked, so the only // frames near this are scan responses on very wide trees. MaxFrameSize = 16 << 20 )
Variables ¶
var ErrBodyTooLarge = errors.New("body exceeds declared size")
ErrBodyTooLarge reports a body that exceeded the size its request declared. The endpoint stops reading rather than filling the workspace volume.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is one end of the protocol. Reads are single-threaded by the request/response discipline; writes take a mutex because a body is written as many frames and must not interleave with anything else.
func (*Conn) DiscardBody ¶
DiscardBody drains a body the caller has decided not to keep. The stream is a single pipe with no way to cancel, so an unwanted body must still be read to its end before the next request can be sent.
func (*Conn) ReadBody ¶
ReadBody consumes chunk frames into dst until the eof chunk. A frame that is not a chunk is a protocol violation: the peer cannot start something else while a body is in flight.