ExPool v0.1.1 ExPool.State.Queue

Manages the queue of waiting requests of the pool.

Summary

Functions

Removes an item from the queue

Builds a new queue

Pops an item from the queue

Adds an item to the queue

Returns the number of waiting processes

Types

item :: any
items :: :queue.queue
t :: %ExPool.State.Queue{items: items}

Functions

keep(queue, filter)

Specs

keep(t, (item -> boolean)) :: t

Removes an item from the queue.

new(config)

Specs

new(config :: [Keyword]) :: t

Builds a new queue.

pop(queue)

Specs

pop(t) :: {:ok, {item, t}} | {:empty, t}

Pops an item from the queue.

push(queue, item)

Specs

push(t, item) :: t

Adds an item to the queue.

size(queue)

Specs

size(t) :: non_neg_integer

Returns the number of waiting processes.