Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a thread-safe circular buffer for storing Kafka messages
func NewRingBuffer ¶
func NewRingBuffer(size int) *RingBuffer
NewRingBuffer creates a new ring buffer with the specified size.
func (*RingBuffer) Add ¶
func (rb *RingBuffer) Add(msg *sarama.ProducerMessage)
Add inserts a new message into the buffer. If the buffer is full, it overwrites the oldest message.
func (*RingBuffer) GetBatch ¶
func (rb *RingBuffer) GetBatch(batchSize int) []*sarama.ProducerMessage
GetBatch retrieves up to batchSize messages from the ring buffer.
func (*RingBuffer) Size ¶
func (rb *RingBuffer) Size() int
Size returns the current number of messages in the buffer.
Click to show internal directories.
Click to hide internal directories.