Пример #1
0
        public LeaderReplicationService(
            IPublisher publisher,
            Guid instanceId,
            TFChunkDb db,
            IPublisher tcpSendPublisher,
            IEpochManager epochManager,
            int clusterSize,
            bool unsafeAllowSurplusNodes,
            QueueStatsManager queueStatsManager)
        {
            Ensure.NotNull(publisher, "publisher");
            Ensure.NotEmptyGuid(instanceId, "instanceId");
            Ensure.NotNull(db, "db");
            Ensure.NotNull(tcpSendPublisher, "tcpSendPublisher");
            Ensure.NotNull(epochManager, "epochManager");
            Ensure.Positive(clusterSize, "clusterSize");

            _publisher               = publisher;
            _instanceId              = instanceId;
            _db                      = db;
            _tcpSendPublisher        = tcpSendPublisher;
            _epochManager            = epochManager;
            _clusterSize             = clusterSize;
            _unsafeAllowSurplusNodes = unsafeAllowSurplusNodes;
            _queueStats              = queueStatsManager.CreateQueueStatsCollector("Leader Replication Service");

            _lastRolesAssignmentTimestamp = _stopwatch.Elapsed;
            _mainLoopThread = new Thread(MainLoop)
            {
                Name = _queueStats.Name, IsBackground = true
            };
        }
Пример #2
0
        public ThreadBasedScheduler(ITimeProvider timeProvider, QueueStatsManager queueStatsManager)
        {
            Ensure.NotNull(timeProvider, "timeProvider");
            _timeProvider = timeProvider;
            _queueStats   = queueStatsManager.CreateQueueStatsCollector("Timer");

            _timerThread = new Thread(DoTiming);
            _timerThread.IsBackground = true;
            _timerThread.Name         = Name;
            _timerThread.Start();
        }
Пример #3
0
        public IndexCommitterService(IIndexCommitter indexCommitter, IPublisher publisher,
                                     ICheckpoint replicationCheckpoint, ICheckpoint writerCheckpoint, int commitCount, ITableIndex tableIndex, QueueStatsManager queueStatsManager)
        {
            Ensure.NotNull(indexCommitter, "indexCommitter");
            Ensure.NotNull(publisher, "publisher");
            Ensure.NotNull(replicationCheckpoint, "replicationCheckpoint");
            Ensure.NotNull(writerCheckpoint, "writerCheckpoint");
            Ensure.Positive(commitCount, "commitCount");

            _indexCommitter        = indexCommitter;
            _publisher             = publisher;
            _replicationCheckpoint = replicationCheckpoint;
            _writerCheckpoint      = writerCheckpoint;
            _commitCount           = commitCount;
            _tableIndex            = tableIndex;
            _queueStats            = queueStatsManager.CreateQueueStatsCollector("Index Committer");
        }
Пример #4
0
        public StorageChaser(IPublisher leaderBus,
                             IReadOnlyCheckpoint writerCheckpoint,
                             ITransactionFileChaser chaser,
                             IIndexCommitterService indexCommitterService,
                             IEpochManager epochManager,
                             QueueStatsManager queueStatsManager)
        {
            Ensure.NotNull(leaderBus, "leaderBus");
            Ensure.NotNull(writerCheckpoint, "writerCheckpoint");
            Ensure.NotNull(chaser, "chaser");
            Ensure.NotNull(indexCommitterService, "indexCommitterService");
            Ensure.NotNull(epochManager, "epochManager");

            _leaderBus             = leaderBus;
            _writerCheckpoint      = writerCheckpoint;
            _chaser                = chaser;
            _indexCommitterService = indexCommitterService;
            _epochManager          = epochManager;
            _queueStats            = queueStatsManager.CreateQueueStatsCollector("Storage Chaser");

            _flushDelay = 0;
            _lastFlush  = _watch.ElapsedTicks;
        }