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 ¶
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 ¶
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