Esempio n. 1
0
func NewSimpleTxnSubmitter(rmId common.RMId, bootCount uint32, topology *server.Topology, cm paxos.ConnectionManager) *SimpleTxnSubmitter {
	rng := rand.New(rand.NewSource(time.Now().UnixNano()))
	resolver := ch.NewResolver(rng, topology.AllRMs)
	disabled := make(map[common.RMId]server.EmptyStruct, len(topology.AllRMs))
	for _, rmId := range topology.AllRMs {
		disabled[rmId] = server.EmptyStructVal
	}

	cache := ch.NewCache(resolver, topology.AllRMs.NonEmptyLen(), rng)
	if topology.RootVarUUId != nil {
		cache.AddPosition(topology.RootVarUUId, topology.RootPositions)
	}

	sts := &SimpleTxnSubmitter{
		rmId:              rmId,
		bootCount:         bootCount,
		disabledHashCodes: disabled,
		connections:       nil,
		connectionManager: cm,
		outcomeConsumers:  make(map[common.TxnId]txnOutcomeConsumer),
		onShutdown:        make(map[*func(bool)]server.EmptyStruct),
		resolver:          resolver,
		hashCache:         cache,
		topology:          topology,
		rng:               rng,
	}
	return sts
}
Esempio n. 2
0
func NewSimpleTxnSubmitter(rmId common.RMId, bootCount uint32, connPub paxos.ServerConnectionPublisher) *SimpleTxnSubmitter {
	rng := rand.New(rand.NewSource(time.Now().UnixNano()))
	cache := ch.NewCache(nil, rng)

	sts := &SimpleTxnSubmitter{
		rmId:             rmId,
		bootCount:        bootCount,
		connections:      nil,
		connPub:          connPub,
		outcomeConsumers: make(map[common.TxnId]txnOutcomeConsumer),
		onShutdown:       make(map[*func(bool)]server.EmptyStruct),
		hashCache:        cache,
		rng:              rng,
	}
	return sts
}