public void the_first_record_read_is_record1()
        {
            var res = _scavengedChunk.TryReadFirst();

            Assert.IsTrue(res.Success);
            Assert.AreEqual(_rec1, res.LogRecord);
            Assert.AreEqual(_res1.NewPosition, res.NextPosition);
        }
コード例 #2
0
        public void the_record_can_be_read_as_first_one()
        {
            var res = _chunk.TryReadFirst();

            Assert.IsTrue(res.Success);
            Assert.AreEqual(_record, res.LogRecord);
            Assert.AreEqual(_record.GetSizeWithLengthPrefixAndSuffix(), res.NextPosition);
        }
コード例 #3
0
        public void the_first_record_can_be_read()
        {
            var res = _chunk.TryReadFirst();

            Assert.IsTrue(res.Success);
            Assert.AreEqual(_prepare1.GetSizeWithLengthPrefixAndSuffix(), res.NextPosition);
            Assert.IsTrue(res.LogRecord is IPrepareLogRecord <TStreamId>);
            Assert.AreEqual(_prepare1, res.LogRecord);
        }
コード例 #4
0
        public void sequencial_read_returns_no_records()
        {
            var records          = new List <LogRecord>();
            RecordReadResult res = _scavengedChunk.TryReadFirst();

            while (res.Success)
            {
                records.Add(res.LogRecord);
                res = _scavengedChunk.TryReadClosestForward((int)res.NextPosition);
            }
            Assert.AreEqual(0, records.Count);
        }
        public void sequencial_read_returns_no_records()
        {
            var records          = new List <ILogRecord>();
            RecordReadResult res = _scavengedChunk.TryReadFirst();

            while (res.Success)
            {
                records.Add(res.LogRecord);
                res = _scavengedChunk.TryReadClosestForward((int)res.NextPosition);
            }

            if (LogFormatHelper <TLogFormat, TStreamId> .IsV2)
            {
                Assert.AreEqual(0, records.Count);
            }
            else
            {
                Assert.AreEqual(1, records.Count);
            }
        }
 public void no_record_can_be_read_as_first_record()
 {
     Assert.IsFalse(_chunk.TryReadFirst().Success);
 }
コード例 #7
0
        public void there_is_no_first_record()
        {
            var res = _chunk.TryReadFirst();

            Assert.IsFalse(res.Success);
        }
コード例 #8
0
 private void TraverseChunk(TFChunk.TFChunk chunk, 
                            Action<PrepareLogRecord> processPrepare, 
                            Action<CommitLogRecord> processCommit,
                            Action<SystemLogRecord> processSystem)
 {
     var result = chunk.TryReadFirst();
     while (result.Success)
     {
         var record = result.LogRecord;
         switch (record.RecordType)
         {
             case LogRecordType.Prepare:
             {
                 var prepare = (PrepareLogRecord)record;
                 processPrepare(prepare);
                 break;
             }
             case LogRecordType.Commit:
             {
                 var commit = (CommitLogRecord)record;
                 processCommit(commit);
                 break;
             }
             case LogRecordType.System:
             {
                 var system = (SystemLogRecord)record;
                 processSystem(system);
                 break;
             }
             default:
                 throw new ArgumentOutOfRangeException();
         }
         result = chunk.TryReadClosestForward((int)result.NextPosition);
     }
 }
コード例 #9
0
        public void the_first_record_cant_be_read()
        {
            var res = _scavengedChunk.TryReadFirst();

            Assert.IsFalse(res.Success);
        }