func (t *TxnTracker) NewLinuxDataResyncTxn() linuxclient.DataResyncDSL {
	txn := &Txn{}
	dsl := mocklinux.NewMockDataResyncDSL(
		func(values map[string]proto.Message) error {
			return t.commit(txn, t.applyDataResyncTxnOps, values)
		})
	txn.LinuxDataResyncTxn = dsl
	t.PendingTxns[txn] = struct{}{}
	return dsl
}
NewLinuxDataResyncTxn is a factory for Linux Plugins's RESYNC transactions.
package localclient
import (
	"sync"
	"github.com/golang/protobuf/proto"
	"go.ligato.io/cn-infra/v2/datasync"
	"go.ligato.io/cn-infra/v2/datasync/syncbase"
	linuxclient "go.ligato.io/vpp-agent/v3/clientv2/linux"
	vppclient "go.ligato.io/vpp-agent/v3/clientv2/vpp"
	mockcontroller "github.com/contiv/vpp/mock/localclient/controller"
	mocklinux "github.com/contiv/vpp/mock/localclient/dsl/linux"
	mockvpp "github.com/contiv/vpp/mock/localclient/dsl/vpp"
)
type TxnTracker struct {
	lock sync.Mutex
	txnSeqNum uint64
	LatestRevisions *syncbase.PrevRevisions
	CommittedTxns []*Txn
	PendingTxns map[*Txn]struct{}
	onCommit func(txn *Txn, latestRevs *syncbase.PrevRevisions) error
}
type ConfigSnapshot map[string]proto.Message
type Txn struct {
	LinuxDataResyncTxn *mocklinux.MockDataResyncDSL
	LinuxDataChangeTxn *mocklinux.MockDataChangeDSL
	VPPDataResyncTxn *mockvpp.MockDataResyncDSL
	VPPDataChangeTxn *mockvpp.MockDataChangeDSL
}
func NewTxnTracker(onCommit func(txn *Txn, latestRevs *syncbase.PrevRevisions) error) *TxnTracker {
	tracker := &TxnTracker{onCommit: onCommit}
	tracker.Clear()
	return tracker
}
func (t *TxnTracker) NewLinuxDataChangeTxn() linuxclient.DataChangeDSL {
	txn := &Txn{}
	dsl := mocklinux.NewMockDataChangeDSL(
		func(values map[string]proto.Message) error {
			return t.commit(txn, t.applyDataChangeTxnOps, values)
		})
	txn.LinuxDataChangeTxn = dsl
	t.PendingTxns[txn] = struct{}{}
	return dsl
}
func (t *TxnTracker) NewVPPDataChangeTxn() vppclient.DataChangeDSL {
	txn := &Txn{}
	dsl := mockvpp.NewMockDataChangeDSL(
		func(values map[string]proto.Message) error {
			return t.commit(txn, t.applyDataChangeTxnOps, values)
		})
	txn.VPPDataChangeTxn = dsl
	t.PendingTxns[txn] = struct{}{}
	return dsl
}
func (t *TxnTracker) applyDataChangeTxnOps(values map[string]proto.Message) {
	for key, value := range values {
		if value != nil {
			change := syncbase.NewChange(key, value, 0, datasync.Put)
			t.LatestRevisions.Put(key, change)
		} else {
			t.LatestRevisions.Del(key)
		}
	}
}