Documentation
¶
Overview ¶
Package outputstream implements Wire's encoded-output framing. It owns no runtime resources and does not interpret encoded payloads.
Index ¶
- Constants
- func Chunks(data []byte, size int, send func(*wirev1.OutputFrame) error) error
- func Descriptor(value api.Metadata) *wirev1.OutputMetadata
- func End(value *wirev1.OutputTerminal) *wirev1.OutputFrame
- func Header(value api.Metadata) *wirev1.OutputFrame
- func MaxChunk(limit int, envelope func(*wirev1.OutputFrame) proto.Message) (int, error)
- func Metadata(value *wirev1.OutputMetadata) (api.Metadata, error)
- type Accumulator
- type Decoder
Constants ¶
const ChunkSize = 64 << 10
ChunkSize is the preferred maximum encoded chunk, before envelope overhead.
const Version uint32 = 1
Version is required in both directions of the Connect handshake.
Variables ¶
This section is empty.
Functions ¶
func Descriptor ¶
func Descriptor(value api.Metadata) *wirev1.OutputMetadata
Descriptor preserves the original complete-payload metadata.
func End ¶
func End(value *wirev1.OutputTerminal) *wirev1.OutputFrame
End commits the number of bytes actually transferred, independently of metadata.
func Header ¶
func Header(value api.Metadata) *wirev1.OutputFrame
Header starts a transfer without establishing whether content is present.
Types ¶
type Accumulator ¶
Accumulator materializes only bytes actually delivered. Its first Add marks content present, including for an empty chunk; metadata never sizes storage.
func (*Accumulator) Add ¶
func (a *Accumulator) Add(data []byte)
Add copies borrowed bytes before the next receive can reuse them.
func (*Accumulator) Content ¶
func (a *Accumulator) Content() *api.Content
Content transfers the accumulated detached content to the caller.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder validates one ordered transfer. It retains only metadata and counters; callers decide whether to deliver borrowed chunks or accumulate detached data.
func (*Decoder) Accept ¶
func (d *Decoder) Accept(frame *wirev1.OutputFrame) ([]byte, bool, *wirev1.OutputTerminal, error)
Accept returns either a chunk or the terminal result. A header returns neither.