batches

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package batches contains support code for working with and testing batches of data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Batch

func Batch(count int, fn func(begin, end int) error) error

Batch is a helper to perform some operation over a large number of values in a batch-oriented fashion. The indexes provided to the callback function are a half-open range [begin , end).

func Size

func Size() int

Size returns the default size for batch operations. Testing code should generally use a multiple of this value to ensure that batching has been correctly implemented.

func Window

func Window(batchSize, count int, fn func(begin, end int) error) error

Window is a helper to perform some operation over a large number of values in a batch-oriented fashion, using the supplied batch size. The indexes provided to the callback function are a half-open range [begin , end).

Types

type Release

type Release func()

The Release function must be called to return the underlying array back to the pool.

func Mutation

func Mutation() ([]types.Mutation, Release)

Mutation returns a slice of Size() capacity.

Jump to

Keyboard shortcuts

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