コード例 #1
0
ファイル: ReadIndex.cs プロジェクト: arthis/EventStore-1
        public ReadIndex(IPublisher bus,
                         ObjectPool <ITransactionFileReader> readerPool,
                         ITableIndex tableIndex,
                         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.Nonnegative(streamInfoCacheCapacity, "streamInfoCacheCapacity");
            Ensure.Positive(metastreamMaxCount, "metastreamMaxCount");
            Ensure.NotNull(replicationCheckpoint, "replicationCheckpoint");
            Ensure.NotNull(indexCheckpoint, "indexCheckpoint");

            var metastreamMetadata = new StreamMetadata(maxCount: metastreamMaxCount);

            IIndexBackend indexBackend = new IndexBackend(readerPool, streamInfoCacheCapacity, streamInfoCacheCapacity);

            _indexReader = new IndexReader(indexBackend, tableIndex, metastreamMetadata, hashCollisionReadLimit,
                                           skipIndexScanOnReads);
            _indexWriter    = new IndexWriter(indexBackend, _indexReader);
            _indexCommitter = new IndexCommitter(bus, indexBackend, _indexReader, tableIndex, indexCheckpoint, additionalCommitChecks);
            _allReader      = new AllReader(indexBackend, _indexCommitter);
        }
コード例 #2
0
ファイル: ReadIndex.cs プロジェクト: mjaric/EventStore
        public ReadIndex(IPublisher bus,
                         ObjectPool <ITransactionFileReader> readerPool,
                         ITableIndex <TStreamId> tableIndex,
                         INameIndexConfirmer <TStreamId> streamNameIndex,
                         IValueLookup <TStreamId> streamIds,
                         IStreamNamesProvider <TStreamId> streamNamesProvider,
                         TStreamId emptyStreamName,
                         IValidator <TStreamId> streamIdValidator,
                         ISizer <TStreamId> sizer,
                         INameExistenceFilter streamExistenceFilter,
                         IExistenceFilterReader <TStreamId> streamExistenceFilterReader,
                         INameIndexConfirmer <TStreamId> eventTypeIndex,
                         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.NotNull(streamExistenceFilter, nameof(streamExistenceFilter));
            Ensure.NotNull(streamExistenceFilterReader, nameof(streamExistenceFilterReader));

            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,
                                                       streamExistenceFilterReader, metastreamMetadata, hashCollisionReadLimit, skipIndexScanOnReads);

            _streamIds   = streamIds;
            _streamNames = streamNamesProvider.StreamNames;
            var systemStreams  = streamNamesProvider.SystemStreams;
            var eventTypeNames = streamNamesProvider.EventTypes;
            var streamExistenceFilterInitializer = streamNamesProvider.StreamExistenceFilterInitializer;

            _indexWriter    = new IndexWriter <TStreamId>(indexBackend, _indexReader, _streamIds, _streamNames, systemStreams, emptyStreamName, sizer);
            _indexCommitter = new IndexCommitter <TStreamId>(bus, indexBackend, _indexReader, tableIndex, streamNameIndex,
                                                             _streamNames, eventTypeIndex, eventTypeNames, systemStreams, streamExistenceFilter,
                                                             streamExistenceFilterInitializer, indexCheckpoint, additionalCommitChecks);
            _allReader = new AllReader <TStreamId>(indexBackend, _indexCommitter, _streamNames, eventTypeNames);
        }