batcher

package
v0.0.0-...-c6e60ff Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package batcher provides retriable batch queue: all succeed or rollback for all. In kafka it is called RecordAccumulator.

Package batcher provides retriable batch queue: all succeed or rollback for all. In kafka it is called RecordAccumulator.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStopping = errors.New("batcher stopping")
)

Functions

This section is empty.

Types

type Batcher

type Batcher interface {

	// Close closes the batcher from R/W.
	Close()

	// Put writes an item to the batcher. If queue is full, it will block till
	// all inflight items marked success.
	Put(item interface{}) error

	// Get reads an item from the batcher.
	Get() (interface{}, error)

	// Succeed marks an item handling success.
	Succeed()

	// Fail marks an item handling failure.
	Fail() (rewind bool)
}

Batcher is a batched queue with the sematics of all succeed and advance or any fails and retry.

func NewDisruptor

func NewDisruptor(capacity int) Batcher

NewDisruptor create a new smart disruptor batcher instance.

func NewDryrun

func NewDryrun(capacity int) Batcher

NewDryrun creates a dryrun batcher. Used for debugging.

Directories

Path Synopsis
A smoke test for batcher package.
A smoke test for batcher package.

Jump to

Keyboard shortcuts

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