ordered

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

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 ordered runs bounded preparation concurrently and commits in input order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run[T any](ctx context.Context, opts Options[T]) error

Run prepares at most Concurrency jobs at once and retains at most twice that many uncommitted results. A barrier is prepared only after its predecessors commit. Cancellation joins workers and disposes every uncommitted result before returning.

Types

type Options

type Options[T any] struct {
	Count       int
	Concurrency int
	Barrier     func(int) bool
	Prepare     func(context.Context, int) (T, error)
	Commit      func(int, T, error) error
	Dispose     func(T)
}

Options supplies the isolated preparation and ordered commit operations. Commit receives preparation errors, allowing callers to report and continue.

Jump to

Keyboard shortcuts

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