inmem

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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

func NewWorkQueue(limit int) workqueue.Interface

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL