batchingchannels

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchingChannel

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

BatchingChannel implements the Channel interface, with the change that instead of producing individual elements on Out(), it batches together the entire internal buffer each time. Trying to construct an unbuffered batching channel will panic, that configuration is not supported (and provides no benefit over an unbuffered NativeChannel).

func NewBatchingChannel

func NewBatchingChannel(ctx context.Context, allocate *vector.Allocate, maxWorker int64, size int) *BatchingChannel

func (*BatchingChannel) Cap

func (ch *BatchingChannel) Cap() int

func (*BatchingChannel) Close

func (ch *BatchingChannel) Close()

func (*BatchingChannel) In

func (ch *BatchingChannel) In() chan<- string

func (*BatchingChannel) Len

func (ch *BatchingChannel) Len() int

func (*BatchingChannel) Out

func (ch *BatchingChannel) Out() <-chan vector.Vector

Out returns a <-chan vector.Vector in order that BatchingChannel conforms to the standard Channel interface provided by this package, however each output value is guaranteed to be of type vector.Vector - a vector collecting the most recent batch of values sent on the In channel. The vector is guaranteed to not be empty or nil.

func (*BatchingChannel) ProcessOut

func (ch *BatchingChannel) ProcessOut(f func(vector.Vector) error) error

Jump to

Keyboard shortcuts

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