Documentation
¶
Overview ¶
Package inmem provides an in-memory workqueue implementation intended for testing.
The in-memory workqueue is not suitable for production use — it does not persist state across restarts and does not support distributed deployments. Use it in tests alongside the conformance package to verify workqueue consumer behavior.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWorkQueue ¶
NewWorkQueue creates a new in-memory workqueue. This is intended for testing, and is not suitable for production use.
Example ¶
ExampleNewWorkQueue demonstrates creating an in-memory workqueue and performing basic queue and enumerate operations.
package main
import (
"context"
"fmt"
"chainguard.dev/driftlessaf/workqueue"
"chainguard.dev/driftlessaf/workqueue/inmem"
)
func main() {
wq := inmem.NewWorkQueue(5)
ctx := context.Background()
if err := wq.Queue(ctx, "my-key", workqueue.Options{}); err != nil {
panic(err)
}
_, queued, _, err := wq.Enumerate(ctx)
if err != nil {
panic(err)
}
fmt.Printf("Queued keys: %d\n", len(queued))
}
Output: Queued keys: 1
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.