localclient

package
v0.0.0-...-2d08fe4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package localclient contains mocks for transactions created by DSL structures in localclient packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigSnapshot

type ConfigSnapshot map[string]proto.Message

ConfigSnapshot represents the current state of a mock DB.

type Txn

type Txn struct {
	// LinuxDataResyncTxn is non-nil for Linux Plugin's RESYNC transaction.
	LinuxDataResyncTxn *mocklinux.MockDataResyncDSL
	// LinuxDataChangeTxn is non-nil for Linux Plugin's Data Change transaction.
	LinuxDataChangeTxn *mocklinux.MockDataChangeDSL
	// VPPDataResyncTxn is non-nil for VPP Plugins's Data Resync transaction.
	VPPDataResyncTxn *mockvpp.MockDataResyncDSL
	// VPPDataChangeTxn is non-nil for VPP Plugin's Data Change transaction.
	VPPDataChangeTxn *mockvpp.MockDataChangeDSL
}

Txn stores all information about a transaction. Exactly one of the fields is non-nil.

type TxnTracker

type TxnTracker struct {

	// LatestRevisions maintains the map of keys & values with revision.
	LatestRevisions *syncbase.PrevRevisions
	// CommittedTxns is a list finalized transaction in the order as they were
	// committed.
	CommittedTxns []*Txn
	// PendingTxns is map of pending (uncommitted) transactions.
	PendingTxns map[*Txn]struct{}
	// contains filtered or unexported fields
}

TxnTracker tracks all transactions executed or pending in the mock localclient.

func NewTxnTracker

func NewTxnTracker(onCommit func(txn *Txn, latestRevs *syncbase.PrevRevisions) error) *TxnTracker

NewTxnTracker is a constructor for TxnTracker. It is the entry-point to the mock localclient for both linux and vpp.

func (*TxnTracker) Clear

func (t *TxnTracker) Clear()

Clear clears the TxnTracker state. Already created transactions become invalid.

func (*TxnTracker) NewControllerTxn

func (t *TxnTracker) NewControllerTxn(isResync bool) *mockcontroller.MockControllerTxn

NewControllerTxn is a factory for Controller's transaction. It also implements adapter between localclient and Controller transactions.

func (*TxnTracker) NewLinuxDataChangeTxn

func (t *TxnTracker) NewLinuxDataChangeTxn() linuxclient.DataChangeDSL

NewLinuxDataChangeTxn is a factory for DataChange transactions.

func (*TxnTracker) NewLinuxDataResyncTxn

func (t *TxnTracker) NewLinuxDataResyncTxn() linuxclient.DataResyncDSL

NewLinuxDataResyncTxn is a factory for Linux Plugins's RESYNC transactions.

func (*TxnTracker) NewVPPDataChangeTxn

func (t *TxnTracker) NewVPPDataChangeTxn() vppclient.DataChangeDSL

NewVPPDataChangeTxn is a factory for VPP Plugins's DataChange transactions.

func (*TxnTracker) NewVPPDataResyncTxn

func (t *TxnTracker) NewVPPDataResyncTxn() vppclient.DataResyncDSL

NewVPPDataResyncTxn is a factory for VPP plugins's RESYNC transactions.

Directories

Path Synopsis
dsl
Package dsl is base package for mocks of DSL transaction creators.
Package dsl is base package for mocks of DSL transaction creators.
vpp

Jump to

Keyboard shortcuts

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