public RocksDbKeyValueRepository(string folder, DataStoreSerializer dataStoreSerializer) { Directory.CreateDirectory(folder); this.dataStoreSerializer = dataStoreSerializer; // Open a connection to a new DB and create if not found var options = new DbOptions().SetCreateIfMissing(true); this.rocksdb = DB.Open(options, folder); }
public RocksDbChainStore(Network network, DataFolder dataFolder, ChainIndexer chainIndexer) { this.network = network; this.ChainIndexer = chainIndexer; this.nearTipHeaders = new MemoryCountCache <uint256, BlockHeader>(601); this.recentHeaders = new MemoryCountCache <uint256, BlockHeader>(100); this.locker = new object(); // Open a connection to a new DB and create if not found var options = new DbOptions().SetCreateIfMissing(true); this.rocksdb = DB.Open(options, dataFolder.ChainPath); }
public RocksdbBlockRepository(Network network, string folder, ILoggerFactory loggerFactory, DataStoreSerializer dataStoreSerializer) { Guard.NotNull(network, nameof(network)); Guard.NotEmpty(folder, nameof(folder)); Directory.CreateDirectory(folder); var options = new DbOptions().SetCreateIfMissing(true); this.rocksdb = DB.Open(options, folder); this.Locker = new object(); this.logger = loggerFactory.CreateLogger(this.GetType().FullName); this.network = network; this.dataStoreSerializer = dataStoreSerializer; this.genesisTransactions = network.GetGenesis().Transactions.ToDictionary(k => k.GetHash()); }
public RocksDbCoindb(Network network, string folder, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, INodeStats nodeStats, DataStoreSerializer dataStoreSerializer) { Guard.NotNull(network, nameof(network)); Guard.NotEmpty(folder, nameof(folder)); this.dataStoreSerializer = dataStoreSerializer; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); // Open a connection to a new DB and create if not found var options = new DbOptions().SetCreateIfMissing(true); this.rocksdb = DB.Open(options, folder); this.network = network; this.performanceCounter = new BackendPerformanceCounter(dateTimeProvider); nodeStats.RegisterStats(this.AddBenchStats, StatsType.Benchmark, this.GetType().Name, 400); }
/// <summary> /// Initializes a new instance of the object. /// </summary> /// <param name="network">Specification of the network the node runs on - RegTest/TestNet/MainNet.</param> /// <param name="folder"><see cref="RocksDbProvenBlockHeaderRepository"/> folder path to the DBreeze database files.</param> /// <param name="loggerFactory">Factory to create a logger for this type.</param> /// <param name="dataStoreSerializer">The serializer to use for <see cref="IBitcoinSerializable"/> objects.</param> public RocksDbProvenBlockHeaderRepository(Network network, string folder, ILoggerFactory loggerFactory, DataStoreSerializer dataStoreSerializer) { Guard.NotNull(network, nameof(network)); Guard.NotNull(folder, nameof(folder)); this.dataStoreSerializer = dataStoreSerializer; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); Directory.CreateDirectory(folder); // Open a connection to a new DB and create if not found var options = new DbOptions().SetCreateIfMissing(true); this.rocksdb = DB.Open(options, folder); this.locker = new object(); this.network = network; }