Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForAllAsync ¶
func ForAllAsync(ctx context.Context, length int, cancelOnErr bool, routine func(context.Context, int, context.CancelFunc) error) error
ForAllAsync runs the provided funcction concurrently for every entry in the length provided in such a way that cancellation will short-circuit execution of the remaining functions. The routine is provided with a context that will be notified when short-circuiting occurs and a cancallation function that can be used to short-circuit the operation. If cancelOnErr is set to true, then routines will be not run after one returns an error
Types ¶
type Asyncer ¶ added in v1.1.15
type Asyncer[T any] struct { // contains filtered or unexported fields }
Asyncer allows for an operation to be done asynchronously with the control flow and then awaited at the caller's convenience
func NewAsyncer ¶ added in v1.1.15
NewAsyncer creates a new Asyncer
func (*Asyncer[T]) Await ¶ added in v1.1.15
Await blocks execution until something is received on either the errors channel or the results channel and then returns that value to the caller
type Buffer ¶
type Buffer[T any] struct { // contains filtered or unexported fields }
Buffer allows for data to be requested in a quantity that is limited by a single parameter
func NewBuffer ¶
NewBuffer creates a new Buffer that allows concurrent operation on size elements of data
func (*Buffer[T]) Get ¶
Get retrieves an item from the buffer. This function will block if the number of concurrent operations is at the value limited by size. Otherwise, an item will be removed from the data channel, if it exists, and returned. If data was in the channel then true will be returned as well. Otherwise, nil and false will be returned. The Release function should be called once operation on this data has ceased
func (*Buffer[T]) Load ¶
func (buf *Buffer[T]) Load(data ...*T)
Load adds data to the buffer. This function may be called concurrently