Esempio n. 1
0
        public LevelDbCoindb(Network network, string folder, IDateTimeProvider dateTimeProvider,
                             ILoggerFactory loggerFactory, INodeStats nodeStats, DBreezeSerializer dBreezeSerializer)
        {
            Guard.NotNull(network, nameof(network));
            Guard.NotEmpty(folder, nameof(folder));

            this.dBreezeSerializer = dBreezeSerializer;

            this.logger = loggerFactory.CreateLogger(this.GetType().FullName);

            // Open a connection to a new DB and create if not found
            var options = new Options {
                CreateIfMissing = true
            };

            this.leveldb = new DB(options, folder);

            this.network            = network;
            this.performanceCounter = new BackendPerformanceCounter(dateTimeProvider);

            if (nodeStats.DisplayBenchStats)
            {
                nodeStats.RegisterStats(this.AddBenchStats, StatsType.Benchmark, this.GetType().Name, 400);
            }
        }
        public DBreezeCoinView(Network network, string folder)
        {
            Guard.NotNull(network, nameof(network));
            Guard.NotEmpty(folder, nameof(folder));

            this.session            = new DBreezeSingleThreadSession("DBreeze CoinView", folder);
            this.network            = network;
            this.performanceCounter = new BackendPerformanceCounter();
        }
        /// <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">Path to the folder with coinview database files.</param>
        /// <param name="loggerFactory">Factory to be used to create logger for the puller.</param>
        public DBreezeCoinView(Network network, string folder, ILoggerFactory loggerFactory)
        {
            Guard.NotNull(network, nameof(network));
            Guard.NotEmpty(folder, nameof(folder));

            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.session            = new DBreezeSingleThreadSession("DBreeze CoinView", folder);
            this.network            = network;
            this.performanceCounter = new BackendPerformanceCounter();
        }
Esempio n. 4
0
        /// <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">Path to the folder with coinview database files.</param>
        /// <param name="dateTimeProvider">Provider of time functions.</param>
        /// <param name="loggerFactory">Factory to be used to create logger for the puller.</param>
        public DBreezeCoinView(Network network, string folder, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory)
        {
            Guard.NotNull(network, nameof(network));
            Guard.NotEmpty(folder, nameof(folder));

            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.dbreeze            = new DBreezeEngine(folder);
            this.network            = network;
            this.dateTimeProvider   = dateTimeProvider;
            this.performanceCounter = new BackendPerformanceCounter(this.dateTimeProvider);
        }
Esempio n. 5
0
        /// <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">Path to the folder with coinview database files.</param>
        /// <param name="dateTimeProvider">Provider of time functions.</param>
        /// <param name="loggerFactory">Factory to be used to create logger for the puller.</param>
        public DBreezeCoinView(Network network, string folder, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, INodeStats nodeStats)
        {
            Guard.NotNull(network, nameof(network));
            Guard.NotEmpty(folder, nameof(folder));

            // Create the coinview folder if it does not exist.
            Directory.CreateDirectory(folder);

            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.dBreeze            = new DBreezeEngine(folder);
            this.network            = network;
            this.performanceCounter = new BackendPerformanceCounter(dateTimeProvider);

            nodeStats.RegisterStats(this.AddBenchStats, StatsType.Benchmark, 400);
        }
Esempio n. 6
0
        public LevelDbCoindb(Network network, string dataFolder, IDateTimeProvider dateTimeProvider,
                             ILoggerFactory loggerFactory, INodeStats nodeStats, DBreezeSerializer dBreezeSerializer)
        {
            Guard.NotNull(network, nameof(network));
            Guard.NotEmpty(dataFolder, nameof(dataFolder));

            this.dataFolder         = dataFolder;
            this.dBreezeSerializer  = dBreezeSerializer;
            this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
            this.network            = network;
            this.performanceCounter = new BackendPerformanceCounter(dateTimeProvider);

            if (nodeStats.DisplayBenchStats)
            {
                nodeStats.RegisterStats(this.AddBenchStats, StatsType.Benchmark, this.GetType().Name, 400);
            }
        }
Esempio n. 7
0
        public RocksDbCoindb(
            Network network,
            DataFolder dataFolder,
            IDateTimeProvider dateTimeProvider,
            INodeStats nodeStats,
            DBreezeSerializer dBreezeSerializer)
        {
            this.dataFolder         = dataFolder.CoindbPath;
            this.dBreezeSerializer  = dBreezeSerializer;
            this.logger             = LogManager.GetCurrentClassLogger();
            this.network            = network;
            this.performanceCounter = new BackendPerformanceCounter(dateTimeProvider);

            if (nodeStats.DisplayBenchStats)
            {
                nodeStats.RegisterStats(this.AddBenchStats, StatsType.Benchmark, this.GetType().Name, 400);
            }
        }