Beispiel #1
0
        public void return_empty_slice_if_asked_to_read_from_start()
        {
            var read = _conn.ReadAllEventsBackward(Position.Start, 1, false);

            Assert.That(read.IsEndOfStream, Is.True);
            Assert.That(read.Events.Length, Is.EqualTo(0));
        }
Beispiel #2
0
        private void UpgradeProjectionPartitionCheckpoints()
        {
            Log("Looking for projection partition checkpoint streams");
            var from = Position.Start;

            _oldTfScanPercent = 0d;
            var lastSlice = _connection.ReadAllEventsBackward(Position.End, 1, false, _credentials);

            if (lastSlice.Events.Length == 0)
            {
                throw new Exception("Empty TF");
            }
            _lastTfPosition = lastSlice.Events[0].OriginalPosition.Value.PreparePosition;
            AllEventsSlice slice;

            do
            {
                slice = _connection.ReadAllEventsForward(@from, 100, false, _credentials);
                DisplayTfScanProgress(slice);
                foreach (var @event in slice.Events)
                {
                    if (@event.OriginalEventNumber == 0)
                    {
                        UpgradeStreamIfPartitionCheckpoint(@event.OriginalStreamId);
                    }
                }
                from = slice.NextPosition;
            } while (!slice.IsEndOfStream);
            Log("Completed looking for partition checkpoint streams");
        }
 protected void ReadAllBackward(string login, string password)
 {
     Connection.ReadAllEventsBackward(Position.End, 1, false,
                                      login == null && password == null ? null : new UserCredentials(login, password));
 }