public virtual void TestFixtureSetUp() { _logFormat = LogFormatHelper <TLogFormat, TStreamId> .LogFormat; _publisher = new InMemoryBus("publisher"); _tfReader = new FakeInMemoryTfReader(RecordOffset); _tableIndex = new FakeInMemoryTableIndex <TStreamId>(); _readerPool = new ObjectPool <ITransactionFileReader>( "ReadIndex readers pool", 5, 100, () => _tfReader); _indexBackend = new IndexBackend <TStreamId>(_readerPool, 100000, 100000); var logFormat = LogFormatHelper <TLogFormat, TStreamId> .LogFormat; _streamIds = logFormat.StreamIds; _streamNames = logFormat.StreamNames; _systemStreams = logFormat.SystemStreams; _factory = logFormat.StreamNamesProvider; _validator = logFormat.StreamIdValidator; var emptyStreamId = logFormat.EmptyStreamId; _sizer = logFormat.StreamIdSizer; _indexReader = new IndexReader <TStreamId>(_indexBackend, _tableIndex, _factory, _validator, new StreamMetadata(maxCount: 100000), 100, false); _indexWriter = new IndexWriter <TStreamId>(_indexBackend, _indexReader, _streamIds, _streamNames, _systemStreams, emptyStreamId, _sizer); _indexCommitter = new Core.Services.Storage.ReaderIndex.IndexCommitter <TStreamId>(_publisher, _indexBackend, _indexReader, _tableIndex, _streamNames, _systemStreams, new InMemoryCheckpoint(-1), false); WriteEvents(); }
public StreamIdLookupMetastreamDecorator( IStreamIdLookup <long> wrapped, IMetastreamLookup <long> metastreams) { _wrapped = wrapped; _metastreams = metastreams; }
public ReadIndex(IPublisher bus, ObjectPool <ITransactionFileReader> readerPool, ITableIndex <TStreamId> tableIndex, IStreamIdLookup <TStreamId> streamIds, IStreamNamesProvider <TStreamId> streamNamesProvider, TStreamId emptyStreamName, IValidator <TStreamId> streamIdValidator, ISizer <TStreamId> sizer, int streamInfoCacheCapacity, bool additionalCommitChecks, long metastreamMaxCount, int hashCollisionReadLimit, bool skipIndexScanOnReads, IReadOnlyCheckpoint replicationCheckpoint, ICheckpoint indexCheckpoint) { Ensure.NotNull(bus, "bus"); Ensure.NotNull(readerPool, "readerPool"); Ensure.NotNull(tableIndex, "tableIndex"); Ensure.NotNull(streamIds, nameof(streamIds)); Ensure.NotNull(streamNamesProvider, nameof(streamNamesProvider)); Ensure.NotNull(streamIdValidator, nameof(streamIdValidator)); Ensure.NotNull(sizer, nameof(sizer)); Ensure.Nonnegative(streamInfoCacheCapacity, "streamInfoCacheCapacity"); Ensure.Positive(metastreamMaxCount, "metastreamMaxCount"); Ensure.NotNull(replicationCheckpoint, "replicationCheckpoint"); Ensure.NotNull(indexCheckpoint, "indexCheckpoint"); var metastreamMetadata = new StreamMetadata(maxCount: metastreamMaxCount); var indexBackend = new IndexBackend <TStreamId>(readerPool, streamInfoCacheCapacity, streamInfoCacheCapacity); _indexReader = new IndexReader <TStreamId>(indexBackend, tableIndex, streamNamesProvider, streamIdValidator, metastreamMetadata, hashCollisionReadLimit, skipIndexScanOnReads); _streamIds = streamIds; _streamNames = streamNamesProvider.StreamNames; var systemStreams = streamNamesProvider.SystemStreams; _indexWriter = new IndexWriter <TStreamId>(indexBackend, _indexReader, _streamIds, _streamNames, systemStreams, emptyStreamName, sizer); _indexCommitter = new IndexCommitter <TStreamId>(bus, indexBackend, _indexReader, tableIndex, _streamNames, systemStreams, indexCheckpoint, additionalCommitChecks); _allReader = new AllReader <TStreamId>(indexBackend, _indexCommitter, _streamNames); }