Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryQueue ¶
type MemoryQueue struct {
// contains filtered or unexported fields
}
MemoryQueue is a reference QueueCounter implementation that holds the HTTP queue in memory only. Always use NewMemoryQueue to create one of these.
func NewMemoryQueue ¶
func NewMemoryQueue() *MemoryQueue
NewMemoryQueue creates a new empty memory queue
func (*MemoryQueue) Current ¶
func (r *MemoryQueue) Current() (int, error)
Current returns the current size of the queue.
func (*MemoryQueue) Resize ¶
func (r *MemoryQueue) Resize(delta int) error
Resize changes the size of the queue. Further calls to Current() return the newly calculated size if no other Resize() calls were made in the interim.
type QueueCountReader ¶
QueueCountReader represents the size of a virtual HTTP queue, possibly distributed across multiple HTTP server processes. It only can access the current size of the queue, not any other information about requests.
It is concurrency safe.
type QueueCounter ¶
type QueueCounter interface { QueueCountReader Resize(int) error }
QueueCounter represents a virtual HTTP queue, possibly distributed across multiple HTTP server processes. It can only increase or decrease the size of the queue or read the current size of the queue, but not read or modify any other information about it.
Both the mutation and read functionality is concurrency safe, but the read functionality is point-in-time only