Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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
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 ¶
func (b *JSONPayloadBuilder) BuildWithOnErrItemTooBigPolicy( m marshaler.IterableStreamJSONMarshaler, policy OnErrItemTooBigPolicy) (transaction.BytesPayloads, error)
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 )