public TextDeferredIndexer(DBriizeEngine engine)
        {
            this.DBriizeEngine = engine;
            LTrieSettings      = new TrieSettings()
            {
                InternalTable = true
            };
            Storage         = new StorageLayer(Path.Combine(engine.MainFolder, TableFileName), LTrieSettings, engine.Configuration);
            LTrie           = new LTrie(Storage);
            LTrie.TableName = "DBreeze.TextIndexer";

            if (LTrie.Storage.Length > 100000)  //Recreating file if its size more then 100KB and it is empty
            {
                if (LTrie.Count(true) == 0)
                {
                    LTrie.Storage.RecreateFiles();
                    LTrie.Dispose();

                    Storage         = new StorageLayer(Path.Combine(engine.MainFolder, TableFileName), LTrieSettings, engine.Configuration);
                    LTrie           = new LTrie(Storage);
                    LTrie.TableName = "DBreeze.TextIndexer";
                }
            }

            if (LTrie.Count(true) > 0)
            {
                this.StartDefferedIndexing();
            }
        }
Beispiel #2
0
        public InvoiceRepository(ApplicationDbContextFactory contextFactory, string dbreezePath)
        {
            int retryCount = 0;

retry:
            try
            {
                _Engine = new DBriizeEngine(dbreezePath);
            }
            catch when(retryCount++ < 5)
            {
                goto retry;
            }
            _IndexerThread  = new CustomThreadPool(1, "Invoice Indexer");
            _ContextFactory = contextFactory;
        }
Beispiel #3
0
        public InvoiceRepository(ApplicationDbContextFactory contextFactory, string dbreezePath,
                                 BTCPayNetworkProvider networks)
        {
            int retryCount = 0;

retry:
            try
            {
                _Engine = new DBriizeEngine(dbreezePath);
            }
            catch when(retryCount++ < 5)
            {
                goto retry;
            }
            _IndexerThread  = new CustomThreadPool(1, "Invoice Indexer");
            _ContextFactory = contextFactory;
            _Networks       = networks.UnfilteredNetworks;
        }
Beispiel #4
0
        public RepositoryProvider(NBXplorerNetworkProvider networks, KeyPathTemplates keyPathTemplates, ExplorerConfiguration configuration)
        {
            this.keyPathTemplates = keyPathTemplates;
            _Configuration        = configuration;
            var directory = Path.Combine(configuration.DataDir, "db");

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            int tried = 0;

retry:
            try
            {
                _Engine = new DBriizeEngine(new DBriizeConfiguration()
                {
                    DBriizeDataFolderName = directory
                });
            }
            catch when(tried < 10)
            {
                tried++;
                Thread.Sleep(tried * 500);
                goto retry;
            }
            foreach (var net in networks.GetAll())
            {
                var settings = GetChainSetting(net);
                if (settings != null)
                {
                    var repo = net.NBitcoinNetwork.NetworkSet == Liquid.Instance ? new LiquidRepository(_Engine, net, keyPathTemplates, settings.RPC) : new Repository(_Engine, net, keyPathTemplates, settings.RPC);
                    repo.MaxPoolSize  = configuration.MaxGapSize;
                    repo.MinPoolSize  = configuration.MinGapSize;
                    repo.MinUtxoValue = settings.MinUtxoValue;
                    _Repositories.Add(net.CryptoCode, repo);
                }
            }
        }
Beispiel #5
0
        public TransactionsJournal(DBriizeEngine DBriizeEngine)
        {
            Engine = DBriizeEngine;

            this.Init();
        }
Beispiel #6
0
 internal LiquidRepository(DBriizeEngine engine, NBXplorerNetwork network, KeyPathTemplates keyPathTemplates,
                           RPCClient rpcClient) : base(engine, network, keyPathTemplates, rpcClient)
 {
     _rpcClient = rpcClient;
 }
 public TransactionsCoordinator(DBriizeEngine engine)
 {
     this._engine = engine;
 }