stream

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPayloadFull is returned when the payload buffer is full
	ErrPayloadFull = errors.New("reached maximum payload size")

	// ErrItemTooBig is returned when a item alone exceeds maximum payload size
	ErrItemTooBig = errors.New("item alone exceeds maximum payload size")
)

Functions

This section is empty.

Types

type Compressor

type Compressor struct {
	// contains filtered or unexported fields
}

Compressor is in charge of compressing items for a single payload

func NewCompressor

func NewCompressor(input, output *bytes.Buffer, maxPayloadSize, maxUncompressedSize int, header, footer []byte, separator []byte, compressor compression.Component) (*Compressor, error)

NewCompressor returns a new instance of a Compressor

func (*Compressor) AddItem

func (c *Compressor) AddItem(data []byte) error

AddItem will try to add the given item

func (*Compressor) Close

func (c *Compressor) Close() ([]byte, error)

Close closes the Compressor, flushing any remaining uncompressed data

func (*Compressor) Write added in v0.54.0

func (c *Compressor) Write(data []byte) (int, error)

type JSONPayloadBuilder

type JSONPayloadBuilder struct {
	// contains filtered or unexported fields
}

JSONPayloadBuilder is used to build payloads. JSONPayloadBuilder allocates memory based on what was previously need to serialize payloads. Keep that in mind and use multiple JSONPayloadBuilders for different sources.

func NewJSONPayloadBuilder

func NewJSONPayloadBuilder(shareAndLockBuffers bool, config config.Component, compressor compression.Component) *JSONPayloadBuilder

NewJSONPayloadBuilder returns a new JSONPayloadBuilder

func (*JSONPayloadBuilder) BuildWithOnErrItemTooBigPolicy

BuildWithOnErrItemTooBigPolicy serializes a metadata payload and sends it to the forwarder

type OnErrItemTooBigPolicy

type OnErrItemTooBigPolicy int

OnErrItemTooBigPolicy defines the behavior when OnErrItemTooBig occurs.

const (
	// DropItemOnErrItemTooBig skips the error and continues when ErrItemTooBig is encountered
	DropItemOnErrItemTooBig OnErrItemTooBigPolicy = iota

	// FailOnErrItemTooBig returns the error and stop when ErrItemTooBig is encountered
	FailOnErrItemTooBig
)

Jump to

Keyboard shortcuts

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