public ReadAllResult(ResolvedEventRecord[] records, int maxCount, TFPos currentPos, TFPos nextPos, TFPos prevPos, long tfEofPosition)
        {
            Ensure.NotNull(records, "records");

            Records = records;
            MaxCount = maxCount;
            CurrentPos = currentPos;
            NextPos = nextPos;
            PrevPos = prevPos;
            TfEofPosition = tfEofPosition;
        }
 private static TcpClientMessageDto.EventLinkPair[] ConvertToDtos(ResolvedEventRecord[] events)
 {
     var result = new TcpClientMessageDto.EventLinkPair[events.Length];
     for (int i = 0; i < events.Length; ++i)
     {
         result[i] = new TcpClientMessageDto.EventLinkPair(events[i].Event, events[i].Link);
     }
     return result;
 }
        private void DeliverEvent(ResolvedEventRecord @event, long lastCommitPosition)
        {
            EventRecord positionEvent = (@event.Link ?? @event.Event);
            var receivedPosition = new EventPosition(@event.CommitPosition, positionEvent.LogPosition);
            if (_from > receivedPosition)
                throw new Exception(
                    string.Format(
                        "ReadFromTF returned events in incorrect order.  Last known position is: {0}.  Received position is: {1}",
                        _from, receivedPosition));

            _publisher.Publish(
                new ProjectionCoreServiceMessage.CommittedEventDistributed(
                    _distibutionPointCorrelationId, receivedPosition, positionEvent.EventStreamId,
                    positionEvent.EventNumber, @event.Event.EventStreamId, @event.Event.EventNumber, @event.Link != null,
                    new Event(
                        @event.Event.EventId, @event.Event.EventType, (@event.Event.Flags & PrepareFlags.IsJson) != 0,
                        @event.Event.Data, @event.Event.Metadata), receivedPosition.PreparePosition, 100.0f * positionEvent.LogPosition / lastCommitPosition));
        }
            public ReadEventsFromTFCompleted(Guid correlationId, ResolvedEventRecord[] events, RangeReadResult result)
            {
                Ensure.NotNull(events, "events");

                CorrelationId = correlationId;
                Events = events;
                Result = result;
            }