batches

package
v0.0.0-...-4dcfcdd Latest Latest
Warning

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

Go to latest
Published: May 2, 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