public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (previous.Phase != Phase) { throw new ArgumentException( string.Format("Invalid checkpoint tag phase. Expected: {0} Was: {1}", Phase, previous.Phase)); } if (committedEvent.Data.EventOrLinkTargetPosition < previous.Position) { throw new InvalidOperationException( string.Format( "Cannot make a checkpoint tag at earlier position. '{0}' < '{1}'", committedEvent.Data.EventOrLinkTargetPosition, previous.Position)); } var byIndex = _streams.Contains(committedEvent.Data.PositionStreamId); return(byIndex ? previous.UpdateEventTypeIndexPosition( committedEvent.Data.EventOrLinkTargetPosition, _streamToEventType[committedEvent.Data.PositionStreamId], committedEvent.Data.PositionSequenceNumber) : previous.UpdateEventTypeIndexPosition(committedEvent.Data.EventOrLinkTargetPosition)); }
public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.EventReaderPartitionDeleted partitionDeleted) { if (previous.Phase != Phase) { throw new ArgumentException( string.Format("Invalid checkpoint tag phase. Expected: {0} Was: {1}", Phase, previous.Phase)); } if (partitionDeleted.DeleteEventOrLinkTargetPosition < previous.Position) { throw new InvalidOperationException( string.Format( "Cannot make a checkpoint tag at earlier position. '{0}' < '{1}'", partitionDeleted.DeleteEventOrLinkTargetPosition, previous.Position)); } var byIndex = _streams.Contains(partitionDeleted.PositionStreamId); //TODO: handle invalid partition deleted messages without required values return(byIndex ? previous.UpdateEventTypeIndexPosition( partitionDeleted.DeleteEventOrLinkTargetPosition.Value, _streamToEventType[partitionDeleted.PositionStreamId], partitionDeleted.PositionEventNumber.Value) : previous.UpdateEventTypeIndexPosition(partitionDeleted.DeleteEventOrLinkTargetPosition.Value)); }
public override CheckpointTag MakeCheckpointTag( CheckpointTag previous, ReaderSubscriptionMessage.CommittedEventDistributed committedEvent) { if (committedEvent.Data.OriginalPosition < previous.Position) { throw new InvalidOperationException( string.Format( "Cannot make a checkpoint tag at earlier position. '{0}' < '{1}'", committedEvent.Data.OriginalPosition, previous.Position)); } var byIndex = _streams.Contains(committedEvent.Data.PositionStreamId); return(byIndex ? previous.UpdateEventTypeIndexPosition( committedEvent.Data.OriginalPosition, _streamToEventType[committedEvent.Data.PositionStreamId], committedEvent.Data.PositionSequenceNumber) : previous.UpdateEventTypeIndexPosition(committedEvent.Data.OriginalPosition)); }