Exemplo n.º 1
0
 private ProposerContextImpl(Org.Neo4j.cluster.InstanceId me, CommonContextState commonState, LogProvider logging, Timeouts timeouts, Deque <Message> pendingValues, IDictionary <InstanceId, Message> bookedInstances, PaxosInstanceStore paxosInstances, HeartbeatContext heartbeatContext) : base(me, commonState, logging, timeouts)
 {
     this._pendingValues    = pendingValues;
     this._bookedInstances  = bookedInstances;
     this._paxosInstances   = paxosInstances;
     this._heartbeatContext = heartbeatContext;
 }
Exemplo n.º 2
0
 internal ProposerContextImpl(Org.Neo4j.cluster.InstanceId me, CommonContextState commonState, LogProvider logging, Timeouts timeouts, PaxosInstanceStore paxosInstances, HeartbeatContext heartbeatContext) : base(me, commonState, logging, timeouts)
 {
     this._paxosInstances   = paxosInstances;
     this._heartbeatContext = heartbeatContext;
     _pendingValues         = new LinkedList <Message>();
     _bookedInstances       = new Dictionary <InstanceId, Message>();
 }
Exemplo n.º 3
0
 internal LearnerContextImpl(Org.Neo4j.cluster.InstanceId me, CommonContextState commonState, LogProvider logging, Timeouts timeouts, PaxosInstanceStore paxosInstances, AcceptorInstanceStore instanceStore, ObjectInputStreamFactory objectInputStreamFactory, ObjectOutputStreamFactory objectOutputStreamFactory, HeartbeatContext heartbeatContext) : base(me, commonState, logging, timeouts)
 {
     this._heartbeatContext          = heartbeatContext;
     this._instanceStore             = instanceStore;
     this._objectInputStreamFactory  = objectInputStreamFactory;
     this._objectOutputStreamFactory = objectOutputStreamFactory;
     this._paxosInstances            = paxosInstances;
     this._learnMissLogger           = (new CappedLogger(logging.GetLog(typeof(LearnerState)))).setDuplicateFilterEnabled(true);
 }
Exemplo n.º 4
0
 private MultiPaxosContext(ProposerContextImpl proposerContext, AcceptorContextImpl acceptorContext, LearnerContextImpl learnerContext, HeartbeatContextImpl heartbeatContext, ElectionContextImpl electionContext, AtomicBroadcastContextImpl atomicBroadcastContext, CommonContextState commonState, PaxosInstanceStore paxosInstances, ClusterContextImpl clusterContext)
 {
     this._clusterContext         = clusterContext;
     this._proposerContext        = proposerContext;
     this._acceptorContext        = acceptorContext;
     this._learnerContext         = learnerContext;
     this._heartbeatContext       = heartbeatContext;
     this._electionContext        = electionContext;
     this._atomicBroadcastContext = atomicBroadcastContext;
     this._commonState            = commonState;
     this._paxosInstances         = paxosInstances;
 }
Exemplo n.º 5
0
        public MultiPaxosContext(InstanceId me, IEnumerable <ElectionRole> roles, ClusterConfiguration configuration, Executor executor, LogProvider logging, ObjectInputStreamFactory objectInputStreamFactory, ObjectOutputStreamFactory objectOutputStreamFactory, AcceptorInstanceStore instanceStore, Timeouts timeouts, ElectionCredentialsProvider electionCredentialsProvider, Config config)
        {
            _commonState    = new CommonContextState(configuration, config.Get(ClusterSettings.max_acceptors));
            _paxosInstances = new PaxosInstanceStore();

            _heartbeatContext       = new HeartbeatContextImpl(me, _commonState, logging, timeouts, executor);
            _learnerContext         = new LearnerContextImpl(me, _commonState, logging, timeouts, _paxosInstances, instanceStore, objectInputStreamFactory, objectOutputStreamFactory, _heartbeatContext);
            _clusterContext         = new ClusterContextImpl(me, _commonState, logging, timeouts, executor, objectOutputStreamFactory, objectInputStreamFactory, _learnerContext, _heartbeatContext, config);
            _electionContext        = new ElectionContextImpl(me, _commonState, logging, timeouts, roles, _clusterContext, _heartbeatContext, electionCredentialsProvider);
            _proposerContext        = new ProposerContextImpl(me, _commonState, logging, timeouts, _paxosInstances, _heartbeatContext);
            _acceptorContext        = new AcceptorContextImpl(me, _commonState, logging, timeouts, instanceStore);
            _atomicBroadcastContext = new AtomicBroadcastContextImpl(me, _commonState, logging, timeouts, executor, _heartbeatContext);

            _heartbeatContext.setCircularDependencies(_clusterContext, _learnerContext);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create a state snapshot. The snapshot will not duplicate services, and expects the caller to duplicate
        /// <seealso cref="AcceptorInstanceStore"/>, since that is externally provided.
        /// </summary>
        public virtual MultiPaxosContext Snapshot(LogProvider logging, Timeouts timeouts, Executor executor, AcceptorInstanceStore instanceStore, ObjectInputStreamFactory objectInputStreamFactory, ObjectOutputStreamFactory objectOutputStreamFactory, ElectionCredentialsProvider electionCredentialsProvider)
        {
            CommonContextState commonStateSnapshot    = _commonState.snapshot(logging.GetLog(typeof(ClusterConfiguration)));
            PaxosInstanceStore paxosInstancesSnapshot = _paxosInstances.snapshot();

            HeartbeatContextImpl       snapshotHeartbeatContext       = _heartbeatContext.snapshot(commonStateSnapshot, logging, timeouts, executor);
            LearnerContextImpl         snapshotLearnerContext         = _learnerContext.snapshot(commonStateSnapshot, logging, timeouts, paxosInstancesSnapshot, instanceStore, objectInputStreamFactory, objectOutputStreamFactory, snapshotHeartbeatContext);
            ClusterContextImpl         snapshotClusterContext         = _clusterContext.snapshot(commonStateSnapshot, logging, timeouts, executor, objectOutputStreamFactory, objectInputStreamFactory, snapshotLearnerContext, snapshotHeartbeatContext);
            ElectionContextImpl        snapshotElectionContext        = _electionContext.snapshot(commonStateSnapshot, logging, timeouts, snapshotClusterContext, snapshotHeartbeatContext, electionCredentialsProvider);
            ProposerContextImpl        snapshotProposerContext        = _proposerContext.snapshot(commonStateSnapshot, logging, timeouts, paxosInstancesSnapshot, _heartbeatContext);
            AcceptorContextImpl        snapshotAcceptorContext        = _acceptorContext.snapshot(commonStateSnapshot, logging, timeouts, instanceStore);
            AtomicBroadcastContextImpl snapshotAtomicBroadcastContext = _atomicBroadcastContext.snapshot(commonStateSnapshot, logging, timeouts, executor, snapshotHeartbeatContext);

            snapshotHeartbeatContext.SetCircularDependencies(snapshotClusterContext, snapshotLearnerContext);

            return(new MultiPaxosContext(snapshotProposerContext, snapshotAcceptorContext, snapshotLearnerContext, snapshotHeartbeatContext, snapshotElectionContext, snapshotAtomicBroadcastContext, commonStateSnapshot, paxosInstancesSnapshot, snapshotClusterContext));
        }
Exemplo n.º 7
0
 public virtual LearnerContextImpl Snapshot(CommonContextState commonStateSnapshot, LogProvider logging, Timeouts timeouts, PaxosInstanceStore paxosInstancesSnapshot, AcceptorInstanceStore instanceStore, ObjectInputStreamFactory objectInputStreamFactory, ObjectOutputStreamFactory objectOutputStreamFactory, HeartbeatContextImpl snapshotHeartbeatContext)
 {
     return(new LearnerContextImpl(Me, commonStateSnapshot, logging, timeouts, _lastDeliveredInstanceId, _lastLearnedInstanceId, snapshotHeartbeatContext, instanceStore, objectInputStreamFactory, objectOutputStreamFactory, paxosInstancesSnapshot));
 }
Exemplo n.º 8
0
 public virtual ProposerContextImpl Snapshot(CommonContextState commonStateSnapshot, LogProvider logging, Timeouts timeouts, PaxosInstanceStore paxosInstancesSnapshot, HeartbeatContext heartbeatContext)
 {
     return(new ProposerContextImpl(Me, commonStateSnapshot, logging, timeouts, new LinkedList <>(_pendingValues), new Dictionary <>(_bookedInstances), paxosInstancesSnapshot, heartbeatContext));
 }