Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockingFifoQueue ¶
type BlockingFifoQueue struct {
// contains filtered or unexported fields
}
It is a FIFO queue with the functionality that block the caller if the queue size reaches to the maxSize
func NewBlockingFifoQueue ¶
func NewBlockingFifoQueue(size int) *BlockingFifoQueue
func (*BlockingFifoQueue) Dequeue ¶
func (b *BlockingFifoQueue) Dequeue() (interface{}, bool)
func (*BlockingFifoQueue) Enqueue ¶
func (b *BlockingFifoQueue) Enqueue(req interface{})
type NonBlockingFifoQueue ¶
It is a FIFO queue with the functionality that dropping the front if the queue size reaches to the maxSize
func NewNonBlockingFifoQueue ¶
func NewNonBlockingFifoQueue(size int) *NonBlockingFifoQueue
func (*NonBlockingFifoQueue) Dequeue ¶
func (u *NonBlockingFifoQueue) Dequeue() (interface{}, bool)
func (*NonBlockingFifoQueue) Enqueue ¶
func (u *NonBlockingFifoQueue) Enqueue(value interface{})
type NonBlockingLifoQueue ¶
It is a LIFO queue with the functionality that dropping the tail if the queue size reaches to the maxSize
func NewNonBlockingLifoQueue ¶
func NewNonBlockingLifoQueue(size int) *NonBlockingLifoQueue
func (*NonBlockingLifoQueue) Dequeue ¶
func (u *NonBlockingLifoQueue) Dequeue() (interface{}, bool)
func (*NonBlockingLifoQueue) Enqueue ¶
func (u *NonBlockingLifoQueue) Enqueue(value interface{})
enqueue to the head of the queue, delete the tail if the queue has already reached to maxSize
type Publisher ¶
type Publisher struct { // After close is set to true, subsequent calling Publish will be a no-op sync.RWMutex // contains filtered or unexported fields }
Publisher is go-routing safe
func NewPublisher ¶
func NewPublisher(queue Queue, concurrency int64, drainTimeout time.Duration, fn func(req interface{})) (*Publisher, error)
Create a publisher with parameters: queue: specify the underlining queue concurrency: specify the worker thread to consume the queue drainTimeout: time to wait for draining the on-hold requests when calling Close() fn: specify the publishing method to call