public DBTrieInvoiceRepository(IOptions <Config> conf, IKeysRepository keysRepository, ISystemClock systemClock, NRustLightningNetworkProvider networkProvider, ILogger <DBTrieInvoiceRepository> logger) { _dbPath = conf.Value.InvoiceDBFilePath; _keysRepository = keysRepository; _systemClock = systemClock; _networkProvider = networkProvider; _logger = logger; _engine = DBTrieEngine.OpenFromFolder(_dbPath).Result; _engine.ConfigurePagePool(new PagePool(pageSize: conf.Value.DBCacheMB)); }
private async ValueTask <DBTrieEngine> OpenEngine(CancellationToken ct) { int tried = 0; retry: try { return(await DBTrieEngine.OpenFromFolder(_dbPath)); } catch when(tried < 10) { tried++; await Task.Delay(500, ct); goto retry; } }
public void Setup() { folder = @"BenchData"; Directory.CreateDirectory($@"BenchData"); Directory.CreateDirectory($@"{folder}\trie"); trie = DBTrieEngine.OpenFromFolder($@"{folder}\trie").Result; ldb = new DB(new Options { CreateIfMissing = true }, $@"{folder}\ldb"); Directory.CreateDirectory($@"{folder}\litedb"); litedb = new LiteDatabase(new ConnectionString() { Filename = $@"{folder}\litedb\db" }); this.litedbCol = litedb.GetCollection <LiteDbEntity>("tbl"); trx = trie.OpenTransaction().Result; tbl = trx.GetTable("tbl"); rocksdb = rdb.RocksDb.Open(new rdb.DbOptions().SetCreateIfMissing(true), $@"{folder}\rocksdb"); }