cutter

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 2 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchCutter

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

BatchCutter implements batch cutting

func New

func New(client protocol.Client) *BatchCutter

New creates a Cutter implementation

func (*BatchCutter) Add

func (r *BatchCutter) Add(operations ...[]byte) uint

Add adds the given operation(s) to pending batch queue and returns the total number of pending operations.

func (*BatchCutter) AddFirst

func (r *BatchCutter) AddFirst(operations ...[]byte) uint

AddFirst adds the given operation(s) to the front of the pending batch queue and returns the total number of pending operations.

func (*BatchCutter) Cut

func (r *BatchCutter) Cut(force bool) (operations [][]byte, pending uint)

Cut returns the current batch along with number of items remaining in the queue. If force is false then the batch will be cut only if it has reached the max batch size (as specified in the protocol) If force is true then the batch will be cut if there is at least one operation in the batch

type Cutter

type Cutter interface {

	// Add adds the given operation(s) to pending batch queue and returns the total
	// number of pending operations.
	Add(operation ...[]byte) uint

	// AddFirst adds the given operation(s) to the front of the pending batch queue
	// and returns the total number of pending operations.
	AddFirst(bytes ...[]byte) uint

	// Cut returns the current batch along with number of items remaining in the queue.
	// If force is false then the batch will be cut only if it has reached the max batch size (as specified in the protocol)
	// If force is true then the batch will be cut if there is at least one operation in the batch
	Cut(force bool) ([][]byte, uint)
}

Cutter defines queue for batching document operations. It also cuts batch file based on batch size.

Jump to

Keyboard shortcuts

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