Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PersistentRequest ¶ added in v0.37.0
type PersistentRequest interface { // Marshal serializes the current request into a byte stream Marshal() ([]byte, error) // OnProcessingFinished calls the optional callback function to handle cleanup after all processing is finished OnProcessingFinished() // SetOnProcessingFinished allows to set an optional callback function to do the cleanup (e.g. remove the item from persistent queue) SetOnProcessingFinished(callback func()) }
PersistentRequest defines capabilities required for persistent storage of a request
type ProducerConsumerQueue ¶ added in v0.37.0
type ProducerConsumerQueue interface { // StartConsumers starts a given number of goroutines consuming items from the queue // and passing them into the consumer callback. StartConsumers(num int, callback func(item interface{})) // Produce is used by the producer to submit new item to the queue. Returns false if the item wasn't added // to the queue due to queue overflow. Produce(item interface{}) bool // Size returns the current Size of the queue Size() int // Capacity returns capacity of the queue Capacity() int // Stop stops all consumers, as well as the length reporter if started, // and releases the items channel. It blocks until all consumers have stopped. Stop() }
ProducerConsumerQueue defines a producer-consumer exchange which can be backed by e.g. the memory-based ring buffer queue (boundedMemoryQueue) or via a disk-based queue (persistentQueue)
func NewBoundedMemoryQueue ¶ added in v0.37.0
func NewBoundedMemoryQueue(capacity int, onDroppedItem func(item interface{})) ProducerConsumerQueue
NewBoundedMemoryQueue constructs the new queue of specified capacity, and with an optional callback for dropped items (e.g. useful to emit metrics).
type RequestUnmarshaler ¶ added in v0.37.0
type RequestUnmarshaler func([]byte) (PersistentRequest, error)
RequestUnmarshaler defines a function which takes a byte slice and unmarshals it into a relevant request
Click to show internal directories.
Click to hide internal directories.