inmem

package
v0.7.21 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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