com

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: GPL-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bulk

func Bulk(ctx context.Context, ch <-chan interface{}, count int) <-chan []interface{}

Bulk reads all values from a channel and streams them in chunks into a returned channel.

func BulkEntities

func BulkEntities(ctx context.Context, ch <-chan contracts.Entity, count int) <-chan []contracts.Entity

BulkEntities reads all entities from a channel and streams them in chunks into a returned channel.

func BulkXMessages

func BulkXMessages(ctx context.Context, ch <-chan redis.XMessage, count int) <-chan []redis.XMessage

BulkXMessages reads all values from a channel and streams them in chunks into a returned channel.

func CopyFirst

func CopyFirst(
	ctx context.Context, input <-chan contracts.Entity,
) (first contracts.Entity, forward <-chan contracts.Entity, err error)

CopyFirst asynchronously forwards all items from input to forward and synchronously returns the first item.

func ErrgroupReceive

func ErrgroupReceive(g *errgroup.Group, err <-chan error)

ErrgroupReceive adds a goroutine to the specified group that returns the first non-nil error (if any) from the specified channel. If the channel is closed, it will return nil.

func WaitAsync

func WaitAsync(w contracts.Waiter) <-chan error

WaitAsync calls Wait() on the passed Waiter in a new goroutine and sends the first non-nil error (if any) to the returned channel. The returned channel is always closed when the Waiter is done.

Types

type Bulker

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

Bulker reads all values from a channel and streams them in chunks into a Bulk channel.

func NewBulker

func NewBulker(ctx context.Context, ch <-chan interface{}, count int) *Bulker

NewBulker returns a new Bulker and starts streaming.

func (*Bulker) Bulk

func (b *Bulker) Bulk() <-chan []interface{}

Bulk returns the channel on which the bulks are delivered.

type Cond

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

Cond implements a channel-based synchronization for goroutines that wait for signals or send them. Internally based on a controller loop that handles the synchronization of new listeners and signal propagation, which is only started when NewCond is called. Thus the zero value cannot be used.

func NewCond

func NewCond(ctx context.Context) *Cond

NewCond returns a new Cond and starts the controller loop.

func (*Cond) Broadcast

func (c *Cond) Broadcast()

Broadcast sends a signal to all current listeners by closing the previously returned channel from Wait. Panics if the controller loop has already ended.

func (*Cond) Close

func (c *Cond) Close() error

Close stops the controller loop, waits for it to finish, and returns an error if any. Implements the io.Closer interface.

func (*Cond) Done

func (c *Cond) Done() <-chan struct{}

Done returns a channel that will be closed when the controller loop has ended.

func (*Cond) Wait

func (c *Cond) Wait() <-chan struct{}

Wait returns a channel that is closed with the next signal. Panics if the controller loop has already ended.

type Counter

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

Counter implements an atomic counter.

func (*Counter) Add

func (c *Counter) Add(delta uint64)

Add adds the given delta to the counter.

func (*Counter) Inc

func (c *Counter) Inc()

Inc increments the counter by one.

func (*Counter) Reset

func (c *Counter) Reset() uint64

Reset resets the counter to 0 and returns its previous value. Does not reset the total value returned from Total.

func (*Counter) Total

func (c *Counter) Total() uint64

Total returns the total counter value.

func (*Counter) Val

func (c *Counter) Val() uint64

Val returns the current counter value.

type EntityBulker

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

EntityBulker reads all entities from a channel and streams them in chunks into a Bulk channel.

func NewEntityBulker

func NewEntityBulker(ctx context.Context, ch <-chan contracts.Entity, count int) *EntityBulker

NewEntityBulker returns a new EntityBulker and starts streaming.

func (*EntityBulker) Bulk

func (b *EntityBulker) Bulk() <-chan []contracts.Entity

Bulk returns the channel on which the bulks are delivered.

type XMessageBulker

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

XMessageBulker reads all values from a channel and streams them in chunks into a Bulk channel.

func NewXMessageBulker

func NewXMessageBulker(ctx context.Context, ch <-chan redis.XMessage, count int) *XMessageBulker

NewXMessageBulker returns a new XMessageBulker and starts streaming.

func (*XMessageBulker) Bulk

func (b *XMessageBulker) Bulk() <-chan []redis.XMessage

Bulk returns the channel on which the bulks are delivered.

Jump to

Keyboard shortcuts

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