{"modulePath":"github.com/mobiledgex/jaeger","version":"v1.13.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package queue\n\n## Types\n\n```go\ntype BoundedQueue struct {\n\t// contains filtered or unexported fields\n}\n```\nBoundedQueue implements a producer-consumer exchange similar to a ring buffer queue, where the queue is bounded and if it fills up due to slow consumers, the new items written by the producer force the earliest items to be dropped. The implementation is actually based on channels, with a special Reaper goroutine that wakes up when the queue is full and consumers the items from the top of the queue until its size drops back to maxSize\n\n```go\nfunc NewBoundedQueue(capacity int, onDroppedItem func(item interface{})) *BoundedQueue\n```\nNewBoundedQueue constructs the new queue of specified capacity, and with an optional callback for dropped items (e.g. useful to emit metrics).\n\n```go\nfunc (q *BoundedQueue) Capacity() int\n```\nCapacity returns capacity of the queue\n\n```go\nfunc (q *BoundedQueue) Produce(item interface{}) bool\n```\nProduce is used by the producer to submit new item to the queue. Returns false in case of queue overflow.\n\n```go\nfunc (q *BoundedQueue) Size() int\n```\nSize returns the current size of the queue\n\n```go\nfunc (q *BoundedQueue) StartConsumers(num int, consumer func(item interface{}))\n```\nStartConsumers starts a given number of goroutines consuming items from the queue and passing them into the consumer callback.\n\n```go\nfunc (q *BoundedQueue) StartLengthReporting(reportPeriod time.Duration, gauge metrics.Gauge)\n```\nStartLengthReporting starts a timer-based gorouting that periodically reports current queue length to a given metrics gauge.\n\n```go\nfunc (q *BoundedQueue) Stop()\n```\nStop stops all consumers, as well as the length reporter if started, and releases the items channel. It blocks until all consumers have stopped.\n\n","path":"github.com/mobiledgex/jaeger/pkg/queue","name":"queue","synopsis":"","isRedistributable":true}
