func NewAcceptorManager(rmId common.RMId, exe *dispatcher.Executor, cm ConnectionManager, db *db.Databases) *AcceptorManager { am := &AcceptorManager{ ServerConnectionPublisher: NewServerConnectionPublisherProxy(exe, cm), RMId: rmId, DB: db, Exe: exe, instances: make(map[instanceId]*instance), acceptors: make(map[common.TxnId]*acceptorInstances), } exe.Enqueue(func() { am.Topology = cm.AddTopologySubscriber(eng.AcceptorSubscriber, am) }) return am }
func NewProposerManager(exe *dispatcher.Executor, rmId common.RMId, cm ConnectionManager, db *db.Databases, varDispatcher *eng.VarDispatcher) *ProposerManager { pm := &ProposerManager{ ServerConnectionPublisher: NewServerConnectionPublisherProxy(exe, cm), RMId: rmId, proposals: make(map[instanceIdPrefix]*proposal), proposers: make(map[common.TxnId]*Proposer), VarDispatcher: varDispatcher, Exe: exe, DB: db, topology: nil, } exe.Enqueue(func() { pm.topology = cm.AddTopologySubscriber(eng.ProposerSubscriber, pm) }) return pm }
func NewVarManager(exe *dispatcher.Executor, rmId common.RMId, tp TopologyPublisher, db *db.Databases, lc LocalConnection) *VarManager { vm := &VarManager{ LocalConnection: lc, RMId: rmId, db: db, active: make(map[common.VarUUId]*Var), RollAllowed: false, callbacks: []func(){}, exe: exe, } exe.Enqueue(func() { vm.Topology = tp.AddTopologySubscriber(VarSubscriber, vm) vm.RollAllowed = vm.Topology == nil || !vm.Topology.NextBarrierReached1(rmId) }) return vm }