Documentation ¶
Overview ¶
Package parcour tries to make parallelism and concurrency patterns easy.
Index ¶
Constants ¶
const Unbuffered = 0
Unbuffered can be used with `NewProducersWithBuffer` to obtain an unbuffered `Producers`.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsumersError ¶
type ConsumersError struct {
// contains filtered or unexported fields
}
ConsumersError holds any errors returned by consumer goroutines.
func (*ConsumersError) Error ¶
func (e *ConsumersError) Error() string
func (*ConsumersError) Unwrap ¶
func (e *ConsumersError) Unwrap() error
type Producers ¶
type Producers[T any] struct { // contains filtered or unexported fields }
Producers implements a multiple producer, multiple consumer pattern.
Producers create a series of items that the consumers... consume!
func NewProducersWithBuffer ¶
func NewProducersWithBuffer[T any](producersGrp, consumersGrp jobgroup.JobGroup, bufferCap int) *Producers[T]
NewProducersWithBuffer returns a new `Producers` with the given buffer capacity.
The buffer capacity configures backpressure. It is the maximum number of items produced without a consumer receiving them. Once that limit is reached, producers will block on send, waiting for a consumer to receive.
This function panics if `bufferCap` is negative.
func NewUnbufferedProducers ¶
NewUnbufferedProducers returns a new `Producers`.
The producers are unbuffered, meaning they will block after producing each item until a consumer receives it.
This function is equivalent to `NewProducersWithBuffer(parentGroup, Unbuffered)`.
func (*Producers[T]) BufferCap ¶
BufferCap returns the receiver's buffer capacity.
The result is undefined if the receiver's `Wait` or `Close` methods were called, though it is guaranteed the function will not panic in that case.
func (*Producers[T]) Close ¶
func (p *Producers[T]) Close()
Close waits for the producers, closes the items channel, and then waits for consumers.
type ProducersError ¶
type ProducersError struct {
// contains filtered or unexported fields
}
ProducersError holds any errors returned by producer goroutines.
func (*ProducersError) Error ¶
func (e *ProducersError) Error() string
func (*ProducersError) Unwrap ¶
func (e *ProducersError) Unwrap() error
Directories ¶
Path | Synopsis |
---|---|
Package jobgroup provides building blocks for structured concurrency, and composable concurrency patterns.
|
Package jobgroup provides building blocks for structured concurrency, and composable concurrency patterns. |
Package zync provides generic and safer wrappers for types from the standard sync module.
|
Package zync provides generic and safer wrappers for types from the standard sync module. |
atomix
Package atomix provides generic and safer wrappers for types from the standard atomic module.
|
Package atomix provides generic and safer wrappers for types from the standard atomic module. |