protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
     IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder,
     PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
     IProjectionProcessingPhase firstPhase)
 {
     return new[] {firstPhase};
 }
        protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
            IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder,
            PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
            IProjectionProcessingPhase firstPhase)
        {
            var coreProjectionCheckpointWriter =
                new CoreProjectionCheckpointWriter(
                    namingBuilder.MakeCheckpointStreamName(), ioDispatcher, _projectionVersion, _name);
            var checkpointManager2 = new DefaultCheckpointManager(
                publisher, projectionCorrelationId, _projectionVersion, _projectionConfig.RunAs, ioDispatcher,
                _projectionConfig, _name, new PhasePositionTagger(1), namingBuilder, GetUseCheckpoints(), false,
                _sourceDefinition.DefinesFold, coreProjectionCheckpointWriter);

            IProjectionProcessingPhase writeResultsPhase;

            if (GetProducesRunningResults() ||
                !string.IsNullOrEmpty(_sourceDefinition.CatalogStream) && _sourceDefinition.ByStreams)
            {
                writeResultsPhase = new WriteQueryEofProjectionProcessingPhase(
                    1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2,
                    checkpointManager2);
            }
            else
            {
                writeResultsPhase = new WriteQueryResultProjectionProcessingPhase(
                    1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2,
                    checkpointManager2);
            }

            return(new[] { firstPhase, writeResultsPhase });
        }
        protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
            IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder,
            PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
            IProjectionProcessingPhase firstPhase)
        {

            var coreProjectionCheckpointWriter =
                new CoreProjectionCheckpointWriter(
                    namingBuilder.MakeCheckpointStreamName(), ioDispatcher, _projectionVersion, _name);
            var checkpointManager2 = new DefaultCheckpointManager(
                publisher, projectionCorrelationId, _projectionVersion, _projectionConfig.RunAs, ioDispatcher,
                _projectionConfig, _name, new PhasePositionTagger(1), namingBuilder, GetUseCheckpoints(), false,
                _sourceDefinition.DefinesFold, coreProjectionCheckpointWriter);

            IProjectionProcessingPhase writeResultsPhase;
            if (GetProducesRunningResults()
                || !string.IsNullOrEmpty(_sourceDefinition.CatalogStream) && _sourceDefinition.ByStreams)
                writeResultsPhase = new WriteQueryEofProjectionProcessingPhase(
                    1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2,
                    checkpointManager2);
            else
                writeResultsPhase = new WriteQueryResultProjectionProcessingPhase(
                    1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2,
                    checkpointManager2);

            return new[] {firstPhase, writeResultsPhase};
        }
Beispiel #4
0
 protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
     IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder,
     PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
     IProjectionProcessingPhase firstPhase)
 {
     return(new [] { firstPhase });
 }
Beispiel #5
0
        private void BeginPhase(IProjectionProcessingPhase processingPhase, CheckpointTag startFrom)
        {
            _projectionProcessingPhase = processingPhase;
            _checkpointManager         = processingPhase.CheckpointManager;

            _projectionProcessingPhase.InitializeFromCheckpoint(startFrom);
            _checkpointManager.Start(startFrom);
        }
Beispiel #6
0
        private void BeginPhase(IProjectionProcessingPhase processingPhase, CheckpointTag startFrom, PartitionState rootPartitionState)
        {
            _projectionProcessingPhase = processingPhase;
            _projectionProcessingPhase.SetProjectionState(PhaseState.Starting);
            _checkpointManager = processingPhase.CheckpointManager;

            _projectionProcessingPhase.InitializeFromCheckpoint(startFrom);
            _checkpointManager.Start(startFrom, rootPartitionState);
        }
Beispiel #7
0
 protected abstract IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
     IPublisher publisher,
     IPublisher inputQueue,
     Guid projectionCorrelationId,
     ProjectionNamesBuilder namingBuilder,
     PartitionStateCache partitionStateCache,
     CoreProjection coreProjection,
     IODispatcher ioDispatcher,
     IProjectionProcessingPhase firstPhase);
Beispiel #8
0
 private void EnterInitial()
 {
     _completed = false;
     _partitionStateCache.Initialize();
     _projectionProcessingPhase = null;
     _checkpointManager         = _projectionProcessingPhases[0].CheckpointManager;
     _checkpointManager.Initialize();
     _checkpointReader.Initialize();
     _tickPending = false;
     if (_requiresRootPartition)
     {
         _partitionStateCache.CacheAndLockPartitionState("", new PartitionState("", null, CheckpointTag.Empty), null);
     }
     // NOTE: this is to workaround exception in GetState requests submitted by client
 }
Beispiel #9
0
        protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
            IPublisher publisher, IPublisher inputQueue, Guid projectionCorrelationId,
            ProjectionNamesBuilder namingBuilder,
            PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
            IProjectionProcessingPhase firstPhase)
        {
            var coreProjectionCheckpointWriter =
                new CoreProjectionCheckpointWriter(
                    namingBuilder.MakeCheckpointStreamName(), ioDispatcher, _projectionVersion, _name);
            var checkpointManager2 = new DefaultCheckpointManager(
                publisher, projectionCorrelationId, _projectionVersion, SystemAccount.Principal, ioDispatcher,
                _projectionConfig, _name, new PhasePositionTagger(1), namingBuilder, GetUseCheckpoints(), false,
                _sourceDefinition.DefinesFold, coreProjectionCheckpointWriter);

            IProjectionProcessingPhase writeResultsPhase;

            if (GetProducesRunningResults())
            {
                writeResultsPhase = new WriteQueryEofProjectionProcessingPhase(
                    publisher,
                    1,
                    namingBuilder.GetResultStreamName(),
                    coreProjection,
                    partitionStateCache,
                    checkpointManager2,
                    checkpointManager2,
                    firstPhase.EmittedStreamsTracker);
            }
            else
            {
                writeResultsPhase = new WriteQueryResultProjectionProcessingPhase(
                    publisher,
                    1,
                    namingBuilder.GetResultStreamName(),
                    coreProjection,
                    partitionStateCache,
                    checkpointManager2,
                    checkpointManager2,
                    firstPhase.EmittedStreamsTracker);
            }

            return(new[] { firstPhase, writeResultsPhase });
        }
        protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
            IPublisher publisher,
            IPublisher inputQueue,
            Guid projectionCorrelationId,
            ProjectionNamesBuilder namingBuilder,
            PartitionStateCache partitionStateCache,
            CoreProjection coreProjection,
            IODispatcher ioDispatcher,
            IProjectionProcessingPhase firstPhase)
        {
            var coreProjectionCheckpointWriter =
                new CoreProjectionCheckpointWriter(
                    namingBuilder.MakeCheckpointStreamName(),
                    ioDispatcher,
                    _projectionVersion,
                    _name);
            var checkpointManager2 = new DefaultCheckpointManager(
                publisher,
                projectionCorrelationId,
                _projectionVersion,
                _projectionConfig.RunAs,
                ioDispatcher,
                _projectionConfig,
                _name,
                new PhasePositionTagger(1),
                namingBuilder,
                GetUseCheckpoints(),
                false,
                _sourceDefinition.DefinesFold,
                coreProjectionCheckpointWriter);

            var writeResultsPhase = new WriteQueryEofProjectionProcessingPhase(
                publisher,
                1,
                namingBuilder.GetResultStreamName(),
                coreProjection,
                partitionStateCache,
                checkpointManager2,
                checkpointManager2,
                firstPhase.EmittedStreamsTracker);

            return new[] {firstPhase, writeResultsPhase};
        }
 protected abstract IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
     IPublisher publisher,
     IPublisher inputQueue,
     Guid projectionCorrelationId,
     ProjectionNamesBuilder namingBuilder,
     PartitionStateCache partitionStateCache,
     CoreProjection coreProjection,
     IODispatcher ioDispatcher,
     IProjectionProcessingPhase firstPhase);