controller

package
v2.1.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitFunc

type CommitFunc = func(values map[string]proto.Message) error

CommitFunc is function called from the mock to trigger transaction processing in TxnTracker.

type MockControllerTxn

type MockControllerTxn struct {
	Values controller.KeyValuePairs
	// contains filtered or unexported fields
}

MockControllerTxn is a mock implementation of the Transaction interface from Controller.

func NewMockControllerTxn

func NewMockControllerTxn(seqNum uint64, commitFunc CommitFunc) *MockControllerTxn

NewMockControllerTxn is a constructor for mock Controller Txn.

func (*MockControllerTxn) Commit

func (m *MockControllerTxn) Commit(ctx context.Context) (seqNum uint64, err error)

Commit applies the requested transaction changes.

func (*MockControllerTxn) Delete

func (m *MockControllerTxn) Delete(key string)

Delete adds request to the transaction to delete an existing value.

func (*MockControllerTxn) Get

func (m *MockControllerTxn) Get(key string) proto.Message

Get is used to obtain value already prepared to be applied by this transaction. Until the transaction is committed, provided values can still be changed.

func (*MockControllerTxn) Put

func (m *MockControllerTxn) Put(key string, value proto.Message)

Put add request to the transaction to add or modify a value. <value> cannot be nil.

Jump to

Keyboard shortcuts

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