Documentation
¶
Overview ¶
Package buffered provides a buffered writer base for batch writes.
Index ¶
Constants ¶
View Source
const DefaultBatchSize = 10
DefaultBatchSize is the default number of transactions to buffer before flushing.
View Source
const DefaultFlushInterval = 30 * time.Second
DefaultFlushInterval is the default interval between automatic flushes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BatchSize is the number of transactions to buffer before flushing.
// Defaults to DefaultBatchSize.
BatchSize int
// FlushInterval is the interval between automatic flushes.
// Defaults to DefaultFlushInterval.
FlushInterval time.Duration
}
Config holds configuration for buffered writing.
type Flusher ¶
type Flusher func(transactions []*api.TransactionDetails) error
Flusher is called when the buffer needs to be flushed.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer buffers transactions and flushes them in batches.
Click to show internal directories.
Click to hide internal directories.