Documentation
¶
Overview ¶
Package queue provides a bounded priority queue for event persistence. This implements the backpressure mechanism from REVIEW.md.
Index ¶
- Constants
- type Queue
- func (q *Queue) Close()
- func (q *Queue) FillPercent() float64
- func (q *Queue) Len() int
- func (q *Queue) NotifyCh() <-chan struct{}
- func (q *Queue) Pop() *QueueItem
- func (q *Queue) PopBatch(n int) []*QueueItem
- func (q *Queue) Push(item *QueueItem) (dropped bool)
- func (q *Queue) Stats() Stats
- func (q *Queue) Wait(ctx context.Context) bool
- type QueueItem
- type Stats
Constants ¶
View Source
const ( PriorityHigh = "high" // message_start, message_stop, usage PriorityMedium = "medium" // content_block_start/stop PriorityLow = "low" // content_block_delta (drop first) )
Priority levels for events.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is a bounded priority queue with backpressure support.
func (*Queue) FillPercent ¶
FillPercent returns the current fill percentage (0-100).
func (*Queue) NotifyCh ¶
func (q *Queue) NotifyCh() <-chan struct{}
NotifyCh returns a channel that receives notifications when items are added.
func (*Queue) Pop ¶
Pop removes and returns the highest priority item. Returns nil if the queue is empty.
Click to show internal directories.
Click to hide internal directories.