batchcompress

package
v0.0.0-...-2a72a2f Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

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

Batch is a size constrained batch.

func NewBatch

func NewBatch(maxSize int) *Batch

NewBatch creates a size constrained batch.

func (*Batch) Add

func (batch *Batch) Add(d []byte) bool

Add message to batch. Returns false if new message makes batch too big.

func (*Batch) Flush

func (batch *Batch) Flush(w io.Writer)

Flush compresses the batch and writes it to w.

type Batcher

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

Batcher is a time and size constrained batch generator.

func NewBatcher

func NewBatcher(maxSize int, maxAge time.Duration, receiver func([]byte)) *Batcher

NewBatcher creates a new batcher that flushes after maxSize or maxAge are reached. Calls receiver with the result.

func (*Batcher) Add

func (batcher *Batcher) Add(d []byte)

Add message to batcher.

func (*Batcher) Close

func (batcher *Batcher) Close()

Close the batch processing and flush current content..

func (*Batcher) Flush

func (batcher *Batcher) Flush()

Flush the batch: Write output forcefully.

type IntegerType

type IntegerType interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64
}

Jump to

Keyboard shortcuts

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