protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
 {
     return(dbCreator
            .Chunk(Rec.Prepare(0, "$$bla", metadata: new StreamMetadata(10, null, null, null)),
                   Rec.Prepare(0, "$$bla", metadata: new StreamMetadata(9, null, null, null)),
                   Rec.Prepare(0, "$$bla", metadata: new StreamMetadata(8, null, null, null)),
                   Rec.Prepare(0, "$$bla", metadata: new StreamMetadata(5, null, null, null)),
                   Rec.Prepare(0, "$$bla", metadata: new StreamMetadata(2, null, null, null)),
                   Rec.Commit(0, "$$bla"))
            .CompleteLastChunk()
            .CreateDb());
 }
 protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
 {
     return(dbCreator
            .Chunk(Rec.Prepare(0, "$$bla"),
                   Rec.Prepare(0, "$$bla"),
                   Rec.Prepare(0, "$$bla"),
                   Rec.Prepare(0, "$$bla"),
                   Rec.Prepare(0, "$$bla"),
                   Rec.Commit(0, "$$bla"))
            .CompleteLastChunk()
            .CreateDb());
 }
 protected override DbResult CreateDb(TFChunkDbCreationHelper <TLogFormat, TStreamId> dbCreator)
 {
     return(dbCreator.Chunk(Rec.Prepare(0, "test"),
                            Rec.Commit(0, "test"))
            .Chunk(Rec.Prepare(1, "test"),
                   Rec.Commit(1, "test"),
                   Rec.Prepare(2, "$$test",
                               metadata: new StreamMetadata(null, null, EventNumber.DeletedStream, true, null, null)),
                   Rec.Commit(2, "$$test"))
            .CompleteLastChunk()
            .CreateDb());
 }
 protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
 {
     return(dbCreator.Chunk(Rec.Prepare(0, "ES1", version: _version),
                            Rec.Commit(0, "ES1", version: _version),
                            Rec.Prepare(1, "ES1", version: _version),
                            Rec.Commit(1, "ES1", version: _version))
            .CompleteLastChunk()
            .Chunk(Rec.Prepare(2, "ES2", version: _version),
                   Rec.Commit(2, "ES2", version: _version),
                   Rec.Prepare(3, "ES2", version: _version),
                   Rec.Commit(3, "ES2", version: _version))
            .CreateDb());
 }
 protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
 {
     return(dbCreator.Chunk(Rec.Prepare(0, "$$test", metadata: new StreamMetadata(tempStream: true), version: LogRecordVersion.LogRecordV0),
                            Rec.Commit(0, "$$test", version: LogRecordVersion.LogRecordV0),
                            Rec.Prepare(1, "test", version: LogRecordVersion.LogRecordV0),
                            Rec.Commit(1, "test", version: LogRecordVersion.LogRecordV0),
                            Rec.Prepare(2, "test", version: LogRecordVersion.LogRecordV0),
                            Rec.Commit(2, "test", version: LogRecordVersion.LogRecordV0),
                            Rec.Prepare(3, "$$test", metadata: new StreamMetadata(truncateBefore: int.MaxValue, tempStream: true), version: LogRecordVersion.LogRecordV0),
                            Rec.Commit(3, "$$test", version: LogRecordVersion.LogRecordV0))
            .CompleteLastChunk()
            .CreateDb());
 }
 protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
 {
     return(dbCreator.Chunk(Rec.Prepare(0, "$$test", metadata: new StreamMetadata(tempStream: true)),
                            Rec.Commit(0, "$$test"))
            .Chunk(Rec.Prepare(1, "test"),
                   Rec.Commit(1, "test"),
                   Rec.Prepare(2, "test"),
                   Rec.Commit(2, "test"),
                   Rec.Prepare(3, "$$test", metadata: new StreamMetadata(truncateBefore: EventNumber.DeletedStream, tempStream: true)),
                   Rec.Commit(3, "$$test"))
            .CompleteLastChunk()
            .CreateDb());
 }
예제 #7
0
 protected override DbResult CreateDb(TFChunkDbCreationHelper <TLogFormat, TStreamId> dbCreator)
 {
     return(dbCreator
            .Chunk(Rec.Prepare(0, "bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.Commit(0, "bla"))
            .Chunk(Rec.Prepare(2, "bla3"),
                   Rec.Prepare(2, "bla3"),
                   Rec.Commit(1, "bla"),
                   Rec.Commit(2, "bla3"))
            .CompleteLastChunk()
            .CreateDb());
 }
        protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
        {
            var version = LogRecordVersion.LogRecordV0;

            return(dbCreator.Chunk(Rec.Prepare(0, "test", version: version),
                                   Rec.Commit(0, "test", version: version))
                   .Chunk(Rec.Prepare(1, "test", version: version),
                          Rec.Commit(1, "test", version: version),
                          Rec.Prepare(2, "$$test", metadata: new StreamMetadata(null, null, int.MaxValue, true, null, null), version: version),
                          Rec.Commit(2, "$$test", version: version))
                   .Chunk(Rec.Prepare(3, "random", version: version),          // Need an incomplete chunk to ensure writer checkpoints are correct
                          Rec.Commit(3, "random", version: version))
                   .CreateDb());
        }
예제 #9
0
 protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
 {
     return(dbCreator
            .Chunk(Rec.Prepare(0, "$$bla", metadata: new StreamMetadata(null, TimeSpan.FromMinutes(1), null, null, null)),
                   Rec.Commit(0, "$$bla"),
                   Rec.Prepare(1, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(25)),
                   Rec.Commit(1, "bla"),
                   Rec.Prepare(2, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(20)),
                   Rec.Prepare(2, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(10)),
                   Rec.Prepare(2, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(5)),
                   Rec.Prepare(2, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(3)),
                   Rec.Commit(2, "bla"))
            .CompleteLastChunk()
            .CreateDb());
 }
예제 #10
0
 protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
 {
     return(dbCreator.Chunk(Rec.Prepare(0, _deletedMetaStream, metadata: new StreamMetadata(tempStream: true), version: LogRecordVersion.LogRecordV0),
                            Rec.Commit(0, _deletedMetaStream, version: LogRecordVersion.LogRecordV0),
                            Rec.Prepare(1, _keptStream, version: LogRecordVersion.LogRecordV1),
                            Rec.Commit(1, _keptStream, version: LogRecordVersion.LogRecordV1),
                            Rec.Prepare(2, _keptStream, version: LogRecordVersion.LogRecordV0),
                            Rec.Commit(2, _keptStream, version: LogRecordVersion.LogRecordV0),
                            Rec.Prepare(3, _deletedStream, version: LogRecordVersion.LogRecordV1),
                            Rec.Commit(3, _deletedStream, version: LogRecordVersion.LogRecordV0),
                            Rec.Prepare(4, _deletedStream, version: LogRecordVersion.LogRecordV0),
                            Rec.Commit(4, _deletedStream, version: LogRecordVersion.LogRecordV1),
                            Rec.Prepare(5, _keptStream, version: LogRecordVersion.LogRecordV1),
                            Rec.Commit(5, _keptStream, version: LogRecordVersion.LogRecordV1),
                            Rec.Prepare(6, _deletedMetaStream, metadata: new StreamMetadata(truncateBefore: EventNumber.DeletedStream, tempStream: true), version: LogRecordVersion.LogRecordV1),
                            Rec.Commit(6, _deletedMetaStream, version: LogRecordVersion.LogRecordV0))
            .CompleteLastChunk()
            .CreateDb());
 }
 protected override DbResult CreateDb(TFChunkDbCreationHelper <TLogFormat, TStreamId> dbCreator)
 {
     return(dbCreator
            .Chunk(Rec.Prepare(0, "$$bla", metadata: new StreamMetadata(maxCount: 3)),
                   Rec.Commit(0, "$$bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.Commit(1, "bla"),
                   Rec.Prepare(2, "bla"),
                   Rec.Prepare(2, "bla"),
                   Rec.Prepare(2, "bla"),
                   Rec.Prepare(2, "bla"),
                   Rec.Prepare(2, "bla"),
                   Rec.Commit(2, "bla"),
                   Rec.Prepare(3, "bla"),
                   Rec.Prepare(3, "bla"),
                   Rec.Prepare(3, "bla"),
                   Rec.Prepare(3, "bla"),
                   Rec.Commit(3, "bla"))
            .CompleteLastChunk()
            .CreateDb());
 }
예제 #12
0
 protected override DbResult CreateDb(TFChunkDbCreationHelper <TLogFormat, TStreamId> dbCreator)
 {
     return(dbCreator
            .Chunk(Rec.Prepare(0, "$$bla", metadata: new StreamMetadata(truncateBefore: 7)),
                   Rec.Commit(0, "$$bla"),
                   Rec.Prepare(1, "bla"),               // event 0
                   Rec.Commit(1, "bla"),
                   Rec.Prepare(2, "bla"),               // event 1
                   Rec.Prepare(2, "bla"),               // event 2
                   Rec.Prepare(2, "bla"),               // event 3
                   Rec.Prepare(2, "bla"),               // event 4
                   Rec.Prepare(2, "bla"),               // event 5
                   Rec.Commit(2, "bla"),
                   Rec.Prepare(3, "bla"),               // event 6
                   Rec.Prepare(3, "bla"),               // event 7
                   Rec.Prepare(3, "bla"),               // event 8
                   Rec.Prepare(3, "bla"),               // event 9
                   Rec.Commit(3, "bla"))
            .CompleteLastChunk()
            .CreateDb());
 }
예제 #13
0
 protected override DbResult CreateDb(TFChunkDbCreationHelper dbCreator)
 {
     return(dbCreator
            .Chunk(Rec.Prepare(0, "bla"),
                   Rec.Commit(0, "bla"),
                   Rec.TransSt(1, "bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.Prepare(1, "bla"))
            .Chunk(Rec.Prepare(1, "bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.Prepare(1, "bla"),
                   Rec.TransEnd(1, "bla"),
                   Rec.Commit(1, "bla"))
            .Chunk(Rec.Delete(2, "bla"),
                   Rec.Commit(2, "bla"))
            .CompleteLastChunk()
            .CreateDb());
 }
예제 #14
0
 protected override DbResult CreateDb(TFChunkDbCreationHelper <TLogFormat, TStreamId> dbCreator)
 {
     return(dbCreator
            .Chunk(
                Rec.Prepare(0, "$$bla",
                            metadata: new StreamMetadata(3, TimeSpan.FromMinutes(50), null, null, null)),
                Rec.Commit(0, "$$bla"),
                Rec.Prepare(3, "bla"),
                Rec.Commit(3, "bla"),
                Rec.Prepare(1, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(100)),
                Rec.Prepare(1, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(90)),
                Rec.Prepare(1, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(60)),
                Rec.Prepare(1, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(40)),
                Rec.Prepare(1, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(30)),
                Rec.Commit(1, "bla"),
                Rec.Prepare(2, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(20)),
                Rec.Prepare(2, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(3)),
                Rec.Prepare(2, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(2)),
                Rec.Prepare(2, "bla", timestamp: DateTime.UtcNow - TimeSpan.FromMinutes(1)),
                Rec.Commit(2, "bla"))
            .CompleteLastChunk()
            .CreateDb());
 }
예제 #15
0
        public void should_be_able_to_read_the_transactional_writes_when_the_commit_is_present()
        {
            CreateDb(Rec.TransSt(0, "transaction_stream_id"),
                     Rec.Prepare(0, "transaction_stream_id"),
                     Rec.TransEnd(0, "transaction_stream_id"),
                     Rec.Prepare(1, "single_write_stream_id", prepareFlags: PrepareFlags.Data | PrepareFlags.IsCommitted));

            var firstRead = ReadIndex.ReadAllEventsForward(new Data.TFPos(0, 0), 10);

            Assert.AreEqual(1, firstRead.Records.Count);
            Assert.AreEqual("single_write_stream_id", firstRead.Records[0].Event.EventStreamId);

            CreateDb(Rec.TransSt(0, "transaction_stream_id"),
                     Rec.Prepare(0, "transaction_stream_id"),
                     Rec.TransEnd(0, "transaction_stream_id"),
                     Rec.Prepare(1, "single_write_stream_id", prepareFlags: PrepareFlags.Data | PrepareFlags.IsCommitted),
                     Rec.Commit(0, "transaction_stream_id"));

            var transactionRead = ReadIndex.ReadAllEventsForward(firstRead.NextPos, 10);

            Assert.AreEqual(1, transactionRead.Records.Count);
            Assert.AreEqual("transaction_stream_id", transactionRead.Records[0].Event.EventStreamId);
        }