Skip to content

Commit 3472c91

Browse files
authored
docs(readme): add 'choosing a queue' decision table (#62)
1 parent 999212d commit 3472c91

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Benchmarks and Example tests can be found in this package.
3030
* [queue](#queue)
3131
* [Installation](#installation)
3232
* [Import](#import)
33+
* [Choosing a queue](#choosing-a-queue)
3334
* [Usage](#usage)
3435
* [Queue Interface](#queue-interface)
3536
* [Blocking Queue](#blocking-queue)
@@ -54,6 +55,16 @@ To use this package in your project, you can import it as follows:
5455
import "github.com/adrianbrad/queue"
5556
```
5657

58+
## Choosing a queue
59+
60+
| Queue | Ordering | Capacity | Blocks? | Pick this when… |
61+
|------------|---------------------|-----------------------------------------------|----------------------------------------------------|-------------------------------------------------------------------------------------------------|
62+
| `Blocking` | FIFO | Optional; `Offer` errors on full | Yes — `OfferWait`, `GetWait`, `PeekWait` | You want a classic producer–consumer queue with backpressure and blocking semantics. |
63+
| `Priority` | Custom (less func) | Optional; `Offer` errors on full | No | Order depends on a computed value — smallest deadline, highest score, lexicographic, etc. |
64+
| `Circular` | FIFO | Required; `Offer` **overwrites the oldest** | No | You want fixed memory and the most recent N items; dropping older entries is acceptable. |
65+
| `Linked` | FIFO | None (unbounded) | No | You need an unbounded FIFO and don't want to pick a capacity up front. |
66+
| `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. |
67+
5768
## Usage
5869

5970
### Queue Interface

0 commit comments

Comments
 (0)