Categorycode.cloudfoundry.org/go-batching
modulepackage
0.0.0-20240822165321-9efe0c9350d9
Repository: https://github.com/cloudfoundry/go-batching.git
Documentation: pkg.go.dev

# README

Batching

GoDoc

If you have any questions, or want to get attention for a PR or issue please reach out on the #logging-and-metrics channel in the cloudfoundry slack

batching implements a generic Batcher. This batcher uses interface{} and should not be used directly. It should be specialized by creating a type that embeds Batcher but accepts concrete types. See ByteBatcher for an example of specializing the Batcher. Also, see example_test.go for an example of how to use a specialized batcher.

# Functions

NewBatcher creates a new Batcher.
NewByteBatcher creates a new ByteBatcher.

# Structs

Batcher will accept messages and invoke the Writer when the batch requirements have been fulfilled (either batch size or interval have been exceeded).
ByteBatcher batches slices of bytes.

# Interfaces

ByteWriter is used to submit the completed batch of slices of bytes.
Writer is used to submit the completed batch.

# Type aliases

ByteWriterFunc is an adapter to allow ordinary functions to be a ByteWriter.
WriterFunc is an adapter to allow ordinary functions to be a Writer.