Exemple #1
0
            public ClusterNode(
                string clusterTag,
                string url,
                long term,
                JsonContextPool contextPool,
                ClusterMaintenanceSupervisor parent,
                CancellationToken token)
            {
                ClusterTag = clusterTag;
                Url        = url;

                _contextPool = contextPool;
                _parent      = parent;
                _cts         = CancellationTokenSource.CreateLinkedTokenSource(token);
                _token       = _cts.Token;
                _readStatusUpdateDebugString = $"ClusterMaintenanceServer/{ClusterTag}/UpdateState/Read-Response in term {term}";
                _name = $"Heartbeats supervisor from {_parent._server.NodeTag} to {ClusterTag} in term {term}";
                _log  = LoggingSource.Instance.GetLogger <ClusterNode>(_name);
            }
Exemple #2
0
        public ClusterObserver(
            ServerStore server,
            ClusterMaintenanceSupervisor maintenance,
            RachisConsensus <ClusterStateMachine> engine,
            TransactionContextPool contextPool,
            CancellationToken token)
        {
            _maintenance = maintenance;
            _nodeTag     = server.NodeTag;
            _server      = server;
            _engine      = engine;
            _contextPool = contextPool;
            _logger      = LoggingSource.Instance.GetLogger <ClusterObserver>(_nodeTag);
            _cts         = CancellationTokenSource.CreateLinkedTokenSource(token);

            var config = server.Configuration.Cluster;

            SupervisorSamplePeriod   = config.SupervisorSamplePeriod.AsTimeSpan;
            _stabilizationTime       = (long)config.StabilizationTime.AsTimeSpan.TotalMilliseconds;
            _breakdownTimeout        = config.AddReplicaTimeout.AsTimeSpan;
            _hardDeleteOnReplacement = config.HardDeleteOnReplacement;
            _observe = Run(_cts.Token);
        }