Esempio n. 1
0
        public void GetStatistics(ProjectionStatistics info)
        {
            info.Position       = (_lastProcessedEventPosition.LastTag ?? (object)"").ToString();
            info.Progress       = _lastProcessedEventProgress;
            info.LastCheckpoint = _lastCompletedCheckpointPosition != null
                                ? _lastCompletedCheckpointPosition.ToString()
                                : "";

            info.EventsProcessedAfterRestart        = _eventsProcessedAfterRestart;
            info.WritePendingEventsBeforeCheckpoint = 0;
            info.WritePendingEventsAfterCheckpoint  = 0;
            info.ReadsInProgress  = 0;
            info.WritesInProgress = 0;
            info.CheckpointStatus = "";
        }
        public override CheckpointTag AdjustTag(CheckpointTag tag)
        {
            if (tag.Phase < Phase)
            {
                return(tag);
            }
            if (tag.Phase > Phase)
            {
                throw new ArgumentException(
                          string.Format("Invalid checkpoint tag phase.  Expected less or equal to: {0} Was: {1}", Phase,
                                        tag.Phase), "tag");
            }

            if (tag.Mode_ == CheckpointTag.Mode.EventTypeIndex)
            {
                long p;
                return(CheckpointTag.FromEventTypeIndexPositions(
                           tag.Phase, tag.Position,
                           _eventTypes.ToDictionary(v => v, v => tag.Streams.TryGetValue(v, out p) ? p : -1)));
            }

            switch (tag.Mode_)
            {
            case CheckpointTag.Mode.MultiStream:
                throw new NotSupportedException(
                          "Conversion from MultiStream to EventTypeIndex position tag is not supported");

            case CheckpointTag.Mode.Stream:
                throw new NotSupportedException(
                          "Conversion from Stream to EventTypeIndex position tag is not supported");

            case CheckpointTag.Mode.PreparePosition:
                throw new NotSupportedException(
                          "Conversion from PreparePosition to EventTypeIndex position tag is not supported");

            case CheckpointTag.Mode.Position:
                return(CheckpointTag.FromEventTypeIndexPositions(
                           tag.Phase, tag.Position, _eventTypes.ToDictionary(v => v, v => (long)-1)));

            default:
                throw new NotSupportedException(string.Format(
                                                    "The given checkpoint is invalid. Possible causes might include having written an event to the projection's managed stream. The bad checkpoint: {0}",
                                                    tag.ToString()));
            }
        }
Esempio n. 3
0
        public virtual void GetStatistics(ProjectionStatistics info)
        {
            info.Position       = (_lastProcessedEventPosition.LastTag ?? (object)"").ToString();
            info.Progress       = _lastProcessedEventProgress;
            info.LastCheckpoint = _lastCompletedCheckpointPosition != null
                                ? _lastCompletedCheckpointPosition.ToString()
                                : "";

            info.EventsProcessedAfterRestart        = _eventsProcessedAfterRestart;
            info.WritePendingEventsBeforeCheckpoint = _closingCheckpoint != null
                                ? _closingCheckpoint.GetWritePendingEvents()
                                : 0;

            info.WritePendingEventsAfterCheckpoint = (_currentCheckpoint != null
                                ? _currentCheckpoint.GetWritePendingEvents()
                                : 0);
            info.ReadsInProgress =             /*_readDispatcher.ActiveRequestCount*/
                                   + +(_closingCheckpoint != null ? _closingCheckpoint.GetReadsInProgress() : 0)
                                   + (_currentCheckpoint != null ? _currentCheckpoint.GetReadsInProgress() : 0);
            info.WritesInProgress = (_closingCheckpoint != null ? _closingCheckpoint.GetWritesInProgress() : 0)
                                    + (_currentCheckpoint != null ? _currentCheckpoint.GetWritesInProgress() : 0);
            info.CheckpointStatus = _inCheckpoint ? "Requested" : "";
        }
Esempio n. 4
0
 protected override string FromAsText()
 {
     return(_fromPositions.ToString());
 }