regionrun

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 8 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.

func IsSkipRegion added in v0.3.2

func IsSkipRegion(err error) bool

IsSkipRegion reports whether err was produced by SkipRegion.

func SkipRegion added in v0.3.2

func SkipRegion() error

SkipRegion tells ForEach that the current region is not applicable and should not be reported as either progress or an error.

func Wrap added in v0.2.4

func Wrap(errs map[string]error) error

Types

type PartialError added in v0.2.4

type PartialError struct {
	// contains filtered or unexported fields
}

func (PartialError) Error added in v0.2.4

func (e PartialError) Error() string

func (PartialError) ResourceErrors added in v0.2.4

func (e PartialError) ResourceErrors(scope string) []schema.ResourceError

Jump to

Keyboard shortcuts

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