Documentation
¶
Index ¶
- type Buffer
- func (b *Buffer[T]) AcceptedCount() int64
- func (b *Buffer[T]) Capacity() int
- func (b *Buffer[T]) Category() ratelimit.Category
- func (b *Buffer[T]) Clear()
- func (b *Buffer[T]) Drain() []T
- func (b *Buffer[T]) DropRate() float64
- func (b *Buffer[T]) DroppedCount() int64
- func (b *Buffer[T]) GetMetrics() BufferMetrics
- func (b *Buffer[T]) IsEmpty() bool
- func (b *Buffer[T]) IsFull() bool
- func (b *Buffer[T]) IsReadyToFlush() bool
- func (b *Buffer[T]) MarkFlushed()
- func (b *Buffer[T]) Offer(item T) bool
- func (b *Buffer[T]) OfferedCount() int64
- func (b *Buffer[T]) Peek() (T, bool)
- func (b *Buffer[T]) Poll() (T, bool)
- func (b *Buffer[T]) PollBatch(maxItems int) []T
- func (b *Buffer[T]) PollIfReady() []T
- func (b *Buffer[T]) Priority() ratelimit.Priority
- func (b *Buffer[T]) SetDroppedCallback(callback func(item T, reason string))
- func (b *Buffer[T]) Size() int
- func (b *Buffer[T]) Utilization() float64
- type BufferMetrics
- type OverflowPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer[T any] struct { // contains filtered or unexported fields }
Buffer is a thread-safe ring buffer with overflow policies.
func (*Buffer[T]) AcceptedCount ¶
func (*Buffer[T]) DroppedCount ¶
func (*Buffer[T]) GetMetrics ¶
func (b *Buffer[T]) GetMetrics() BufferMetrics
func (*Buffer[T]) IsReadyToFlush ¶
func (*Buffer[T]) MarkFlushed ¶
func (b *Buffer[T]) MarkFlushed()
func (*Buffer[T]) OfferedCount ¶
func (*Buffer[T]) PollIfReady ¶
func (b *Buffer[T]) PollIfReady() []T
func (*Buffer[T]) SetDroppedCallback ¶
func (*Buffer[T]) Utilization ¶
type BufferMetrics ¶
type BufferMetrics struct {
Category ratelimit.Category `json:"category"`
Priority ratelimit.Priority `json:"priority"`
Capacity int `json:"capacity"`
Size int `json:"size"`
Utilization float64 `json:"utilization"`
OfferedCount int64 `json:"offered_count"`
DroppedCount int64 `json:"dropped_count"`
AcceptedCount int64 `json:"accepted_count"`
DropRate float64 `json:"drop_rate"`
LastUpdated time.Time `json:"last_updated"`
}
type OverflowPolicy ¶
type OverflowPolicy int
OverflowPolicy defines how the ring buffer handles overflow.
const ( OverflowPolicyDropOldest OverflowPolicy = iota OverflowPolicyDropNewest )
func (OverflowPolicy) String ¶
func (op OverflowPolicy) String() string
Click to show internal directories.
Click to hide internal directories.