Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch[T Message] struct { // contains filtered or unexported fields }
func (*Batch[T]) GetCommitPositions ¶
func (b *Batch[T]) GetCommitPositions() []wal.CommitPosition
func (*Batch[T]) GetMessages ¶
func (b *Batch[T]) GetMessages() []T
type Config ¶
type Config struct {
// BatchTime is the max time interval at which the batch sending is
// triggered. Defaults to 1s
BatchTimeout time.Duration
// MaxBatchBytes is the max size in bytes for a given batch. When this size is
// reached, the batch is sent. Defaults to 1572864 bytes.
MaxBatchBytes int64
// MaxBatchSize is the max number of messages to be sent per batch. When this
// size is reached, the batch is sent. Defaults to 100.
MaxBatchSize int64
// MaxQueueBytes is the max memory used by the batch writer for inflight
// batches. Defaults to 100MiB
MaxQueueBytes int64
}
func (*Config) GetBatchTimeout ¶
func (*Config) GetMaxBatchBytes ¶
func (*Config) GetMaxBatchSize ¶
func (*Config) GetMaxQueueBytes ¶
type Sender ¶
type Sender[T Message] struct { // contains filtered or unexported fields }
func (*Sender[T]) Close ¶
func (s *Sender[T]) Close()
Close will stop the sending, and wait for all ongoing batches to finish. It is safe to call multiple times.
func (*Sender[T]) SendMessage ¶ added in v0.5.0
func (s *Sender[T]) SendMessage(ctx context.Context, msg *WALMessage[T]) error
SendMessage adds the message to the batch, which will be sent when the interval or the max number of messages is reached by a background process.
type WALMessage ¶
type WALMessage[T Message] struct { // contains filtered or unexported fields }
WALMessage is a wrapper around any kind of message implementing the Message interface which contains a wal commit position.
func NewWALMessage ¶
func NewWALMessage[T Message](msg T, pos wal.CommitPosition) *WALMessage[T]
func (*WALMessage[T]) GetMessage ¶
func (m *WALMessage[T]) GetMessage() T
func (*WALMessage[T]) GetPosition ¶
func (m *WALMessage[T]) GetPosition() wal.CommitPosition
func (*WALMessage[T]) Size ¶
func (m *WALMessage[T]) Size() int
Source Files
¶
Click to show internal directories.
Click to hide internal directories.