outputstream

package
v1.0.0-alpha.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package outputstream implements Wire's encoded-output framing. It owns no runtime resources and does not interpret encoded payloads.

Index

Constants

View Source
const ChunkSize = 64 << 10

ChunkSize is the preferred maximum encoded chunk, before envelope overhead.

View Source
const Version uint32 = 1

Version is required in both directions of the Connect handshake.

Variables

This section is empty.

Functions

func Chunks

func Chunks(data []byte, size int, send func(*wirev1.OutputFrame) error) error

Chunks sends borrowed bytes synchronously. Even empty input emits one chunk.

func Descriptor

func Descriptor(value api.Metadata) *wirev1.OutputMetadata

Descriptor preserves the original complete-payload metadata.

func End

End commits the number of bytes actually transferred, independently of metadata.

func Header(value api.Metadata) *wirev1.OutputFrame

Header starts a transfer without establishing whether content is present.

func MaxChunk

func MaxChunk(limit int, envelope func(*wirev1.OutputFrame) proto.Message) (int, error)

MaxChunk includes the concrete RPC envelope in the message-size calculation.

func Metadata

func Metadata(value *wirev1.OutputMetadata) (api.Metadata, error)

Metadata validates a descriptor without interpreting unknown lengths.

Types

type Accumulator

type Accumulator struct {
	Metadata api.Metadata
	// contains filtered or unexported fields
}

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.

func (*Decoder) Metadata

func (d *Decoder) Metadata() api.Metadata

Metadata returns the immutable descriptor received in the header.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL