public virtual void Initialize()
        {
            if (_currentCheckpoint != null)
            {
                _currentCheckpoint.Dispose();
            }
            if (_closingCheckpoint != null)
            {
                _closingCheckpoint.Dispose();
            }
            _currentCheckpoint            = null;
            _closingCheckpoint            = null;
            _handledEventsAfterCheckpoint = 0;
            _requestedCheckpointPosition  = null;
            _inCheckpoint                    = false;
            _requestedCheckpointState        = new PartitionState("", null, _zeroTag);
            _lastCompletedCheckpointPosition = null;
            _lastProcessedEventPosition.Initialize();
            _lastProcessedEventProgress = -1;

            _eventsProcessedAfterRestart = 0;
            _stateLoaded            = false;
            _started                = false;
            _stopping               = false;
            _stopped                = false;
            _stateRequested         = false;
            _currentProjectionState = new PartitionState("", null, _zeroTag);

            _partitionStateUpdateManager = null;
        }
 protected override void EmitPartitionCheckpoints()
 {
     if (_partitionStateUpdateManager != null)
     {
         _partitionStateUpdateManager.EmitEvents(_currentCheckpoint);
         _partitionStateUpdateManager = null;
     }
 }
 protected override void CapturePartitionStateUpdated(string partition, PartitionState oldState, PartitionState newState)
 {
     if (_partitionStateUpdateManager == null)
     {
         _partitionStateUpdateManager = new PartitionStateUpdateManager(_namingBuilder);
     }
     _partitionStateUpdateManager.StateUpdated(partition, newState, oldState.CausedBy);
 }
 public override void Initialize()
 {
     base.Initialize();
     _partitionStateUpdateManager = null;
     foreach (var requestId in _loadStateRequests)
     {
         _ioDispatcher.BackwardReader.Cancel(requestId);
     }
     _loadStateRequests.Clear();
     _coreProjectionCheckpointWriter.Initialize();
     _requestedCheckpointPosition = null;
     _readRequestsInProgress      = 0;
 }
 public void null_naming_builder_throws_argument_null_exception()
 {
     var updateManager = new PartitionStateUpdateManager(null);
 }
 public void no_exceptions_are_thrown()
 {
     var updateManager = new PartitionStateUpdateManager(new ProjectionNamesBuilder("projection"));
 }
 public void setup()
 {
     _updateManager = new PartitionStateUpdateManager(ProjectionNamesBuilder.CreateForTest("projection"));
     _updateManager.StateUpdated("partition", new PartitionState("{\"state\":1}", null, _one), _zero);
     _updateManager.StateUpdated("partition", new PartitionState("{\"state\":2}", null, _two), _one);
 }
        private void StartCheckpoint(PositionTracker lastProcessedEventPosition, string projectionState)
        {
            CheckpointTag requestedCheckpointPosition = lastProcessedEventPosition.LastTag;
            if (requestedCheckpointPosition == _lastCompletedCheckpointPosition)
                return; // either suggested or requested to stop

            if (_emitPartitionCheckpoints && _partitionStateUpdateManager != null)
            {
                _partitionStateUpdateManager.EmitEvents(_currentCheckpoint);
                _partitionStateUpdateManager = null;
            }

            _inCheckpoint = true;
            _requestedCheckpointPosition = requestedCheckpointPosition;
            _requestedCheckpointState = projectionState;
            _handledEventsAfterCheckpoint = 0;

            _closingCheckpoint = _currentCheckpoint;
            _currentCheckpoint = new ProjectionCheckpoint(
                _publisher, this, requestedCheckpointPosition, _positionTagger.MakeZeroCheckpointTag(), _projectionConfig.MaxWriteBatchLength, _logger);
            // checkpoint only after assigning new current checkpoint, as it may call back immediately
            _closingCheckpoint.Prepare(requestedCheckpointPosition);
        }
 private void CaptureParitionStateUpdated(string partition, PartitionStateCache.State oldState, PartitionStateCache.State newState)
 {
     if (_partitionStateUpdateManager == null)
         _partitionStateUpdateManager = new PartitionStateUpdateManager(_namingBuilder);
     _partitionStateUpdateManager.StateUpdated(partition, newState.Data, oldState.CausedBy, newState.CausedBy);
 }
 public void setup()
 {
     _updateManager = new PartitionStateUpdateManager(new ProjectionNamesBuilder("projection"));
     _updateManager.StateUpdated("partition", "state", _zero, _one);
     _updateManager.StateUpdated("partition", "state2", _one, _two);
 }
 public void setup()
 {
     _updateManager = new PartitionStateUpdateManager(new ProjectionNamesBuilder("projection"));
 }
Beispiel #12
0
 public void setup()
 {
     _updateManager = new PartitionStateUpdateManager(ProjectionNamesBuilder.CreateForTest("projection"));
 }
 private void EmitPartitionCheckpoints()
 {
     if (_partitionStateUpdateManager != null)
     {
         _partitionStateUpdateManager.EmitEvents(_currentCheckpoint);
         _partitionStateUpdateManager = null;
     }
 }
        public virtual void Initialize()
        {
            if (_currentCheckpoint != null) _currentCheckpoint.Dispose();
            if (_closingCheckpoint != null) _closingCheckpoint.Dispose();
            _currentCheckpoint = null;
            _closingCheckpoint = null;
            _handledEventsAfterCheckpoint = 0;
            _requestedCheckpointPosition = null;
            _inCheckpoint = false;
            _requestedCheckpointState = new PartitionState("", null, _zeroTag);
            _lastCompletedCheckpointPosition = null;
            _lastProcessedEventPosition.Initialize();
            _lastProcessedEventProgress = -1;

            _eventsProcessedAfterRestart = 0;
            _stateLoaded = false;
            _started = false;
            _stopping = false;
            _stopped = false;
            _stateRequested = false;
            _currentProjectionState = new PartitionState("", null, _zeroTag);

            _partitionStateUpdateManager = null;
        }