batch

package
v2.260.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Min

func Min(x, y int) int

Min returns the lowest value

func ProcessInBatches

func ProcessInBatches(items []string, processBatch func([]string) error, batchSize int) (processedBatches int, err error)

ProcessInBatches is a generic method that splits the provided items in batches and calls processBatch for each batch

func ProcessInConcurrentBatches

func ProcessInConcurrentBatches(getBatch GenericBatchGetter, processBatch GenericBatchProcessor, batchSize, maxWorkers int) (err error)

ProcessInConcurrentBatches is a generic method to concurrently obtain some resource in batches and then process each batch

Types

type GenericBatchGetter

type GenericBatchGetter func(offset int) (batch interface{}, totalCount int, eTag string, err error)

GenericBatchGetter defines the method signature for a batch getter to obtain a batch of some generic resource

type GenericBatchProcessor

type GenericBatchProcessor func(batch interface{}, batchETag string) (abort bool, err error)

GenericBatchProcessor defines the method signature for a batch processor to process a batch of some generic resource

Jump to

Keyboard shortcuts

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