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");
 }
        public async Task Initialize(IServiceProvider serviceProvider, IConfigurationSection configuration)
        {
            config = new MongoDbStorageEngineConfiguration
            {
                ConnectionString = configuration["connection_string"],
                Database         = configuration["database"] ?? "tedchain",
                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();
            }
        }
Ejemplo n.º 3
0
 public MongoDbLedger(MongoDbStorageEngineConfiguration config, ILogger logger) : base(config, logger)
 {
 }