コード例 #1
0
 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));
 }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
ファイル: BenchmarkDatabases.cs プロジェクト: zyhong/DBTrie
 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");
 }