Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Benchmarks and Example tests can be found in this package.
* [queue](#queue)
* [Installation](#installation)
* [Import](#import)
* [Choosing a queue](#choosing-a-queue)
* [Usage](#usage)
* [Queue Interface](#queue-interface)
* [Blocking Queue](#blocking-queue)
Expand All @@ -54,6 +55,16 @@ To use this package in your project, you can import it as follows:
import "github.com/adrianbrad/queue"
```

## Choosing a queue

| Queue | Ordering | Capacity | Blocks? | Pick this when… |
|------------|---------------------|-----------------------------------------------|----------------------------------------------------|-------------------------------------------------------------------------------------------------|
| `Blocking` | FIFO | Optional; `Offer` errors on full | Yes — `OfferWait`, `GetWait`, `PeekWait` | You want a classic producer–consumer queue with backpressure and blocking semantics. |
| `Priority` | Custom (less func) | Optional; `Offer` errors on full | No | Order depends on a computed value — smallest deadline, highest score, lexicographic, etc. |
| `Circular` | FIFO | Required; `Offer` **overwrites the oldest** | No | You want fixed memory and the most recent N items; dropping older entries is acceptable. |
| `Linked` | FIFO | None (unbounded) | No | You need an unbounded FIFO and don't want to pick a capacity up front. |
| `Delay` | By deadline | Optional; `Offer` errors on full | `GetWait` sleeps until the head's deadline passes | Items should become available at a future time — timers, retry scheduling, TTL expiry. |

## Usage

### Queue Interface
Expand Down
Loading