mocks

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Receiver

type Receiver struct {
	// QueueNext causes Ordered returns nil false when not set to true
	QueueNext bool

	// IsolatedTx causes Ordered returns [][]{curBatch, []{newTx}}, true when set to true
	IsolatedTx bool

	// CutNext causes Ordered returns [][]{append(curBatch, newTx)}, true when set to true
	CutNext bool

	// CurBatch is the currently outstanding messages in the batch
	CurBatch []*cb.Envelope

	// Block is a channel which is read from before returning from Ordered, it is useful for synchronization
	// If you do not wish synchronization for whatever reason, simply close the channel
	Block chan struct{}
}

Receiver mocks the blockcutter.Receiver interface

func NewReceiver

func NewReceiver() *Receiver

NewReceiver returns the mock blockcutter.Receiver implemenation

func (*Receiver) Cut

func (mbc *Receiver) Cut() ([]*cb.Envelope, []filter.Committer)

Cut terminates the current batch, returning it

func (*Receiver) Ordered

func (mbc *Receiver) Ordered(env *cb.Envelope) ([][]*cb.Envelope, [][]filter.Committer, bool)

Ordered will add or cut the batch according to the state of Receiver, it blocks reading from Block on return

Jump to

Keyboard shortcuts

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