Пример #1
0
        public RocksDbProvider(string basePath, IDbConfig dbConfig, ILogManager logManager, bool useTraceDb, bool useReceiptsDb)
        {
            BlocksDb      = new BlocksRocksDb(basePath, dbConfig, logManager);
            HeadersDb     = new HeadersRocksDb(basePath, dbConfig, logManager);
            BlockInfosDb  = new BlockInfosRocksDb(basePath, dbConfig, logManager);
            StateDb       = new StateDb(new StateRocksDb(basePath, dbConfig, logManager));
            CodeDb        = new StateDb(new CodeRocksDb(basePath, dbConfig, logManager));
            PendingTxsDb  = new PendingTxsRocksDb(basePath, dbConfig, logManager);
            ConfigsDb     = new ConfigsRocksDb(basePath, dbConfig, logManager);
            EthRequestsDb = new EthRequestsRocksDb(basePath, dbConfig, logManager);

            if (useReceiptsDb)
            {
                ReceiptsDb = new ReceiptsRocksDb(basePath, dbConfig, logManager);
            }
            else
            {
                ReceiptsDb = new ReadOnlyDb(new MemDb(), false);
            }

            if (useTraceDb)
            {
                TraceDb = new TraceRocksDb(basePath, dbConfig, logManager);
            }
            else
            {
                TraceDb = new ReadOnlyDb(new MemDb(), false);
            }
        }
Пример #2
0
        public ReadOnlyDbProvider(IDbProvider wrappedProvider, bool createInMemoryWriteStore)
        {
            if (wrappedProvider == null)
            {
                throw new ArgumentNullException(nameof(wrappedProvider));
            }

            NestedStateDb = new ReadOnlyDb(wrappedProvider.StateDb, createInMemoryWriteStore);
            StateDb       = new StateDb(NestedStateDb);
            NestedCodeDb  = new ReadOnlyDb(wrappedProvider.CodeDb, createInMemoryWriteStore);
            CodeDb        = new StateDb(NestedCodeDb);
            // StateDb = new ReadOnlyDb(wrappedProvider.StateDb, createInMemoryWriteStore);
            // CodeDb = new ReadOnlyDb(wrappedProvider.CodeDb, createInMemoryWriteStore);
            NestedReceiptsDb             = new ReadOnlyColumnsDb <ReceiptsColumns>(wrappedProvider.ReceiptsDb, createInMemoryWriteStore);
            NestedBlockInfosDb           = new ReadOnlyDb(wrappedProvider.BlockInfosDb, createInMemoryWriteStore);
            NestedBlocksDb               = new ReadOnlyDb(wrappedProvider.BlocksDb, createInMemoryWriteStore);
            NestedHeadersDb              = new ReadOnlyDb(wrappedProvider.HeadersDb, createInMemoryWriteStore);
            NestedPendingTxsDb           = new ReadOnlyDb(wrappedProvider.PendingTxsDb, createInMemoryWriteStore);
            NestedConfigsDb              = new ReadOnlyDb(wrappedProvider.ConfigsDb, createInMemoryWriteStore);
            NestedEthRequestsDb          = new ReadOnlyDb(wrappedProvider.EthRequestsDb, createInMemoryWriteStore);
            NestedBloomDb                = new ReadOnlyDb(wrappedProvider.BloomDb, createInMemoryWriteStore);
            NestedChtDb                  = new ReadOnlyDb(wrappedProvider.ChtDb, createInMemoryWriteStore);
            NestedBaselineTreeDb         = new ReadOnlyDb(wrappedProvider.BaselineTreeDb, createInMemoryWriteStore);
            NestedBaselineTreeMetadataDb = new ReadOnlyDb(wrappedProvider.BaselineTreeMetadataDb, createInMemoryWriteStore);
        }
Пример #3
0
        public RocksDbProvider(string basePath, IDbConfig dbConfig, ILogManager logManager, bool useTraceDb, bool useReceiptsDb)
        {
            BlocksDb = new DbOnTheRocks(
                Path.Combine(basePath, DbOnTheRocks.BlocksDbPath),
                dbConfig, logManager);

            HeadersDb = new DbOnTheRocks(
                Path.Combine(basePath, DbOnTheRocks.HeadersPath),
                dbConfig, logManager);

            BlockInfosDb = new DbOnTheRocks(
                Path.Combine(basePath, DbOnTheRocks.BlockInfosDbPath),
                dbConfig, logManager);

            if (useReceiptsDb)
            {
                ReceiptsDb = new DbOnTheRocks(
                    Path.Combine(basePath, DbOnTheRocks.ReceiptsDbPath),
                    dbConfig, logManager);
            }
            else
            {
                ReceiptsDb = new ReadOnlyDb(new MemDb(), false);
            }

            StateDb = new StateDb(
                new DbOnTheRocks(Path.Combine(basePath, DbOnTheRocks.StateDbPath), dbConfig, logManager));

            CodeDb = new StateDb(
                new DbOnTheRocks(Path.Combine(basePath, DbOnTheRocks.CodeDbPath), dbConfig, logManager));

            PendingTxsDb = new DbOnTheRocks(
                Path.Combine(basePath, DbOnTheRocks.PendingTxsDbPath),
                dbConfig, logManager);

            if (useTraceDb)
            {
                TraceDb = new DbOnTheRocks(
                    Path.Combine(basePath, DbOnTheRocks.TraceDbPath),
                    dbConfig, logManager);
            }
            else
            {
                TraceDb = new ReadOnlyDb(new MemDb(), false);
            }
        }
Пример #4
0
 public IDb GetColumnDb(T key) => _columnDbs.TryGetValue(key, out var db) ? db : _columnDbs[key] = new ReadOnlyDb(_wrappedDb.GetColumnDb(key), _createInMemWriteStore);