regionrun

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package regionrun runs per-region enumeration callbacks in parallel with a bounded concurrency. It matches the existing "partial failure" semantics of the rest of the codebase: a single region's error does not cancel siblings, and errors are returned keyed by region so the caller can surface them via Resources.AddError.

Index

Constants

View Source
const DefaultConcurrency = 6

DefaultConcurrency is the fan-out used when the caller passes concurrency <= 0.

Variables

This section is empty.

Functions

func ForEach

func ForEach[T any](
	ctx context.Context,
	regions []string,
	concurrency int,
	tracker *processbar.RegionTracker,
	fn func(ctx context.Context, region string) ([]T, error),
) ([]T, map[string]error)

ForEach invokes fn for each region, capped at `concurrency` in-flight calls. If tracker is non-nil, each region's completion emits a progress update (serialised — tracker updates are not thread-safe on their own caller side). Returns the aggregated slice and a map of region -> error for regions that failed. Honours ctx.Done() by stopping dispatch of new regions; in-flight fns receive the same ctx and are expected to bail out.

Types

This section is empty.

Jump to

Keyboard shortcuts

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