batch

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const RequestBufferSize = 1 << 17

RequestBufferSize is the amount of requests users can dispatch that haven't been processed yet before dispatching new ones would start blocking.

Variables

This section is empty.

Functions

func NopExecutor

func NopExecutor() *nonBatchingExecutor

Types

type BatchFn

type BatchFn func() (interface{}, error)

type Batcher

type Batcher interface {
	BatchFor(key string, dur time.Duration, fn BatchFn) (interface{}, error)
}

type DelayFn

type DelayFn func(dur time.Duration)

type Executor

type Executor struct {
	Logger logging.Logger
	Delay  DelayFn
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(logger logging.Logger) *Executor

func (*Executor) BatchFor

func (e *Executor) BatchFor(key string, timeout time.Duration, fn BatchFn) (interface{}, error)

func (*Executor) Run

func (e *Executor) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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