示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static org.neo4j.causalclustering.messaging.marshalling.ContentBuilder<ReplicatedContent> deserialize(org.neo4j.storageengine.api.ReadableChannel channel) throws java.io.IOException, org.neo4j.causalclustering.messaging.EndOfStreamException
        public static ContentBuilder <ReplicatedContent> Deserialize(ReadableChannel channel)
        {
            long          mostSigBits   = channel.Long;
            long          leastSigBits  = channel.Long;
            MemberId      owner         = (new MemberId.Marshal()).unmarshal(channel);
            GlobalSession globalSession = new GlobalSession(new System.Guid(mostSigBits, leastSigBits), owner);

            long             localSessionId   = channel.Long;
            long             sequenceNumber   = channel.Long;
            LocalOperationId localOperationId = new LocalOperationId(localSessionId, sequenceNumber);

            return(ContentBuilder.unfinished(subContent => new DistributedOperation(subContent, globalSession, localOperationId)));
        }
示例#2
0
        public ReplicationModule(RaftMachine raftMachine, MemberId myself, PlatformModule platformModule, Config config, Outbound <MemberId, Org.Neo4j.causalclustering.core.consensus.RaftMessages_RaftMessage> outbound, File clusterStateDirectory, FileSystemAbstraction fileSystem, LogProvider logProvider, AvailabilityGuard globalAvailabilityGuard, LocalDatabase localDatabase)
        {
            LifeSupport life = platformModule.Life;

            DurableStateStorage <GlobalSessionTrackerState> sessionTrackerStorage;

            sessionTrackerStorage = life.Add(new DurableStateStorage <>(fileSystem, clusterStateDirectory, SESSION_TRACKER_NAME, new GlobalSessionTrackerState.Marshal(new MemberId.Marshal()), config.Get(CausalClusteringSettings.global_session_tracker_state_size), logProvider));

            _sessionTracker = new SessionTracker(sessionTrackerStorage);

            GlobalSession    myGlobalSession = new GlobalSession(System.Guid.randomUUID(), myself);
            LocalSessionPool sessionPool     = new LocalSessionPool(myGlobalSession);

            _progressTracker = new ProgressTrackerImpl(myGlobalSession);

            Duration initialBackoff    = config.Get(CausalClusteringSettings.replication_retry_timeout_base);
            Duration upperBoundBackoff = config.Get(CausalClusteringSettings.replication_retry_timeout_limit);

            TimeoutStrategy progressRetryStrategy     = new ExponentialBackoffStrategy(initialBackoff, upperBoundBackoff);
            long            availabilityTimeoutMillis = config.Get(CausalClusteringSettings.replication_retry_timeout_base).toMillis();

            _replicator = new RaftReplicator(raftMachine, myself, outbound, sessionPool, _progressTracker, progressRetryStrategy, availabilityTimeoutMillis, globalAvailabilityGuard, logProvider, localDatabase, platformModule.Monitors);
        }
示例#3
0
 public virtual void Update(GlobalSession globalSession, LocalOperationId localOperationId, long logIndex)
 {
     _sessionState.update(globalSession, localOperationId, logIndex);
 }
示例#4
0
 public virtual bool ValidateOperation(GlobalSession globalSession, LocalOperationId localOperationId)
 {
     return(_sessionState.validateOperation(globalSession, localOperationId));
 }
示例#5
0
 public DistributedOperation(ReplicatedContent content, GlobalSession globalSession, LocalOperationId operationId)
 {
     this._content       = content;
     this._globalSession = globalSession;
     this._operationId   = operationId;
 }