Documentation
¶
Overview ¶
Package store provides a configurable batching memory queue for streaming data entries with periodic or size-based flushing to a user-provided Flusher.
It is designed for use cases where entries must be collected and written out in batches, such as for logging, metrics, or any buffered data pipeline.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorHandler ¶
type ErrorHandler interface {
OnError(err error)
}
type Flusher ¶
type Flusher[T any] interface { // Flush sends a batch of entries. // ctx controls cancellation, batching, or deadlines. Flush(ctx context.Context, entries []T) error }
Flusher is an interface for a batch writer. Implementations are responsible for processing a batch of entries atomically. If an error occurs, Flush should return it.
type Option ¶
type Option func(cfg *Config)
func WithBatchSize ¶
func WithCapacity ¶
func WithInterval ¶
func WithOnError ¶
func WithOnError(onError ErrorHandler) Option
type Store ¶
type Store[T any] interface { // Write queues one or more entries into the buffer. Write(entries ...T) // Run starts the background processing loop on the provided context. // The loop continues until the context is canceled. Run(ctx context.Context) }
Store is an interface for buffered write and lifecycle control. Write buffers entries and Run starts processing of submitted entries in background.
Click to show internal directories.
Click to hide internal directories.