batcher

package
v0.0.0-...-ec26dd8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_MAX_MEMORY_BYTES = int64(1024 * 1024 * 100)
	TICKER_RATE              = 1 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchAddError

type BatchAddError int
const (
	BATCH_ADD_OK    BatchAddError = iota // Succeeded adding message to batch.
	BATCH_ADD_FAIL                       // A non-fatal issue with adding to a batch. Could be message can't fit.
	BATCH_ADD_FATAL                      // Batcher is unable to proceed. This may occur if batch is unable to be sent to transport.
)

Batcher's responses to issues adding to a batch.

type BatchRouting

type BatchRouting int
const (
	BATCH_ROUTING_ROUND_ROBIN BatchRouting = iota // Round-robin based routing
	BATCH_ROUTING_PARTITION                       // Partition based routing
)

func GetRoutingMethod

func GetRoutingMethod(name string) BatchRouting

type Batcher

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

func NewBatcher

func NewBatcher(shutdownHandler shutdown.ShutdownHandler,
	inputChan <-chan *marshaller.MarshalledMessage,
	txnsSeenChan chan<- *progress.Seen,
	statsChan chan stats.Stat,

	batchFactory transport.BatchFactory,
	workers int,
	flushBatchUpdateAge int,
	flushBatchMaxAge int,
	batchQueueDepth int,
	maxMemoryBytes int64,
	routingMethod BatchRouting,
) *Batcher

NewBatcher returns a new Batcher with output channels to use as inputs for Transporters. Note the caller must provide a BatchFactory which is compatible with the downstream Transporter. The Batcher does not check check compatibility.

func (*Batcher) GetOutputChans

func (b *Batcher) GetOutputChans() []chan transport.Batch

GetOutputChan returns the outputChans

func (*Batcher) StartBatching

func (b *Batcher) StartBatching()

StartBatching kicks off the batcher which passes filled Batches to Transporters.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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