Documentation
¶
Overview ¶
Package ring, Simple RingBuffer pacakge from https://github.com/sahmad98/go-ringbuffer/blob/master/ring_buffer.go
Ringbuffer is non blocking for readers and writers, writers will overwrite older data in a circular fashion. Readers will read from the current position and update it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RingBuffer ¶
type RingBuffer struct { Size int32 // Size of the Ringbuffer Container []any // Array container of objects Reader int32 // Reader position Writer int32 // Writer Position }
RingBuffer Structure
func NewRingBuffer ¶
func NewRingBuffer(size int32) *RingBuffer
Create a new RingBuffer of initial size "size" Returns a pointer to the new RingBuffer
func (*RingBuffer) Latest ¶
func (r *RingBuffer) Latest() any
Returns the latest element in the RingBuffer
func (*RingBuffer) Oldest ¶
func (r *RingBuffer) Oldest() any
Returns the oldest element in RingBuffer
func (*RingBuffer) Overwrite ¶
func (r *RingBuffer) Overwrite(v any)
Overwrites the latest data in RingBuffer
Click to show internal directories.
Click to hide internal directories.