Documentation
¶
Overview ¶
Package parallel provides utilities for executing independent operations concurrently with controlled parallelism using errgroup and semaphore.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultMaxConcurrency ¶
func DefaultMaxConcurrency() int64
DefaultMaxConcurrency returns the default maximum concurrency based on available CPUs.
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor provides controlled parallel execution of tasks.
func NewExecutor ¶
NewExecutor creates a new parallel executor with the specified max concurrency. If maxConcurrency <= 0, DefaultMaxConcurrency() is used.
type Results ¶
type Results[T any] struct { // contains filtered or unexported fields }
Results collects results from parallel tasks with thread-safe access.
type SyncWriter ¶
type SyncWriter struct {
// contains filtered or unexported fields
}
SyncWriter is a thread-safe writer that serializes writes from multiple goroutines.
func NewSyncWriter ¶
func NewSyncWriter(writer io.Writer) *SyncWriter
NewSyncWriter creates a new synchronized writer wrapping the given writer.