Example #1
0
 public MongoDbStorageEngine(MongoDbStorageEngineConfiguration config, ILogger logger) : base(config.ConnectionString, config.Database)
 {
     Configuration                = config;
     Logger                       = logger;
     RecordCollection             = Database.GetCollection <MongoDbRecord>("records");
     TransactionCollection        = Database.GetCollection <MongoDbTransaction>("transactions");
     PendingTransactionCollection = Database.GetCollection <MongoDbPendingTransaction>("pending_transactions");
 }
Example #2
0
        public async Task Initialize(IServiceProvider serviceProvider, IConfigurationSection configuration)
        {
            config = new MongoDbStorageEngineConfiguration
            {
                ConnectionString = configuration["connection_string"],
                Database         = configuration["database"] ?? "openchain",
                ReadRetryCount   = 10,
                ReadLoopDelay    = TimeSpan.FromMilliseconds(50)
            };
            var s = configuration["stale_transaction_delay"] ?? "00:01:00";

            config.StaleTransactionDelay = TimeSpan.Parse(s);
            using (var m = new MongoDbStorageEngine(config, serviceProvider.GetRequiredService <ILogger>()))
            {
                await m.CreateIndexes();
            }
        }
Example #3
0
 public MongoDbLedger(MongoDbStorageEngineConfiguration config, ILogger logger) : base(config, logger)
 {
 }