Documentation
¶
Overview ¶
Package lockfree provides lock-free data structures for high-performance concurrent processing
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicCounter ¶
type AtomicCounter struct {
// contains filtered or unexported fields
}
AtomicCounter provides a lock-free counter for statistics
func NewAtomicCounter ¶
func NewAtomicCounter() *AtomicCounter
NewAtomicCounter creates a new atomic counter
func (*AtomicCounter) Add ¶
func (c *AtomicCounter) Add(delta uint64)
Add atomically adds a value to the counter
func (*AtomicCounter) Increment ¶
func (c *AtomicCounter) Increment()
Increment atomically increments the counter
func (*AtomicCounter) Reset ¶
func (c *AtomicCounter) Reset()
Reset atomically resets the counter to zero
type MPMCQueue ¶
type MPMCQueue struct {
// contains filtered or unexported fields
}
MPMCQueue implements a lock-free multi-producer multi-consumer queue
func NewMPMCQueue ¶
NewMPMCQueue creates a new multi-producer multi-consumer queue
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue implements a lock-free multi-producer single-consumer queue optimized for 100K+ records/sec throughput
func NewQueue ¶
NewQueue creates a new lock-free queue with given capacity Capacity must be a power of 2 for efficient masking
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer implements a lock-free single-producer single-consumer ring buffer
func NewRingBuffer ¶
func NewRingBuffer(capacity int) *RingBuffer
NewRingBuffer creates a new lock-free ring buffer
func (*RingBuffer) Available ¶
func (rb *RingBuffer) Available() int
Available returns the number of bytes available to read
func (*RingBuffer) Free ¶
func (rb *RingBuffer) Free() int
Free returns the number of bytes available to write
func (*RingBuffer) Read ¶
func (rb *RingBuffer) Read(data []byte) int
Read reads data from the ring buffer
func (*RingBuffer) Write ¶
func (rb *RingBuffer) Write(data []byte) int
Write writes data to the ring buffer