batch

package
v0.0.0-...-adb0082 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Licensed under the GNU General Public License, version 3 or higher.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Item(index int) interface{}
	Len() int
}

A batch is a list of arbitrary items.

type BatchProcessor

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

A batch processor feeds items into a goroutine for processing.

func NewBatchProcessor

func NewBatchProcessor(callback Callback, maxTasks int) *BatchProcessor

Create a new batch processor.

func (*BatchProcessor) AddBatch

func (this *BatchProcessor) AddBatch(batch Batch)

Adds a batch to the batch processor.

func (*BatchProcessor) Finish

func (this *BatchProcessor) Finish()

Signals that no more batches are incoming, and then waits for batch processing to complete.

func (*BatchProcessor) Terminate

func (this *BatchProcessor) Terminate()

Forcefully terminates batch processing. This only shuts down the worker routine. Individual processing tasks will continue.

type Callback

type Callback func(item interface{})

Callback function to process items.

Jump to

Keyboard shortcuts

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