示例#1
0
        public StartupManager(
            ILogFactory logFactory,
            ICandlesCacheInitalizationService cacheInitalizationService,
            RedisCacheCaretaker cacheCaretaker,
            ICandlesSubscriber candlesSubscriber,
            ISnapshotSerializer snapshotSerializer,
            ICandlesPersistenceQueueSnapshotRepository persistenceQueueSnapshotRepository,
            ICandlesPersistenceQueue persistenceQueue,
            ICandlesPersistenceManager persistenceManager,
            bool migrationEnabled)
        {
            if (logFactory == null)
            {
                throw new ArgumentNullException(nameof(logFactory));
            }

            _log = logFactory.CreateLog(this);

            _cacheInitalizationService          = cacheInitalizationService ?? throw new ArgumentNullException(nameof(cacheInitalizationService));
            _cacheCaretaker                     = cacheCaretaker ?? throw new ArgumentNullException(nameof(cacheCaretaker));
            _candlesSubscriber                  = candlesSubscriber ?? throw new ArgumentNullException(nameof(candlesSubscriber));
            _snapshotSerializer                 = snapshotSerializer ?? throw new ArgumentNullException(nameof(snapshotSerializer));
            _persistenceQueueSnapshotRepository = persistenceQueueSnapshotRepository ?? throw new ArgumentNullException(nameof(persistenceQueueSnapshotRepository));
            _persistenceQueue                   = persistenceQueue ?? throw new ArgumentNullException(nameof(persistenceQueue));
            _persistenceManager                 = persistenceManager ?? throw new ArgumentNullException(nameof(persistenceManager));
            _migrationEnabled                   = migrationEnabled;
        }
        public StartupManager(
            ILog log,
            ICandlesCacheInitalizationService cacheInitalizationService,
            ICandlesSubscriber candlesSubscriber,
            ISnapshotSerializer snapshotSerializer,
            ICandlesPersistenceQueueSnapshotRepository persistenceQueueSnapshotRepository,
            ICandlesPersistenceQueue persistenceQueue,
            ICandlesPersistenceManager persistenceManager,
            bool migrationEnabled,
            ICqrsEngine cqrsEngine)
        {
            if (log == null)
            {
                throw new ArgumentNullException(nameof(log));
            }
            _log = log.CreateComponentScope(nameof(StartupManager)) ?? throw new InvalidOperationException("Couldn't create a component scope for logging.");

            _cacheInitalizationService          = cacheInitalizationService ?? throw new ArgumentNullException(nameof(cacheInitalizationService));
            _candlesSubscriber                  = candlesSubscriber ?? throw new ArgumentNullException(nameof(candlesSubscriber));
            _snapshotSerializer                 = snapshotSerializer ?? throw new ArgumentNullException(nameof(snapshotSerializer));
            _persistenceQueueSnapshotRepository = persistenceQueueSnapshotRepository ?? throw new ArgumentNullException(nameof(persistenceQueueSnapshotRepository));
            _persistenceQueue   = persistenceQueue ?? throw new ArgumentNullException(nameof(persistenceQueue));
            _persistenceManager = persistenceManager ?? throw new ArgumentNullException(nameof(persistenceManager));
            _migrationEnabled   = migrationEnabled;
            _cqrsEngine         = cqrsEngine ?? throw new ArgumentNullException(nameof(cqrsEngine));
        }
示例#3
0
 public CandlesManager(
     ICandlesCacheService candlesCacheService,
     ICandlesPersistenceQueue candlesPersistenceQueue)
 {
     _candlesCacheService     = candlesCacheService;
     _candlesPersistenceQueue = candlesPersistenceQueue;
 }
        public AssetPairMigrationManager(
            IHealthService healthService,
            ICandlesPersistenceQueue candlesPersistenceQueue,
            MigrationCandlesGenerator candlesGenerator,
            AssetPairMigrationTelemetryService telemetryService,
            IAssetPair assetPair,
            ILog log,
            BidAskHCacheService bidAskHCacheService,
            IHistoryProvider historyProvider,
            ICandlesHistoryMigrationService candlesHistoryMigrationService,
            Action <string> onStoppedAction,
            MigrationSettings settings)
        {
            _healthService           = healthService;
            _candlesPersistenceQueue = candlesPersistenceQueue;
            _candlesGenerator        = candlesGenerator;
            _telemetryService        = telemetryService;
            _assetPair                      = assetPair;
            _log                            = log;
            _bidAskHCacheService            = bidAskHCacheService;
            _historyProvider                = historyProvider;
            _candlesHistoryMigrationService = candlesHistoryMigrationService;
            _onStoppedAction                = onStoppedAction;
            _settings                       = settings;

            _cts = new CancellationTokenSource();
        }
示例#5
0
        public ShutdownManager(
            ILogFactory logFactory,
            ICandlesSubscriber candlesSubscriber,
            ISnapshotSerializer snapshotSerializer,
            ICandlesPersistenceQueueSnapshotRepository persistenceQueueSnapshotRepository,
            ICandlesPersistenceQueue persistenceQueue,
            ICandlesPersistenceManager persistenceManager,
            CandlesMigrationManager migrationManager,
            bool migrationEnabled)
        {
            if (logFactory == null)
            {
                throw new ArgumentNullException(nameof(logFactory));
            }

            _log = logFactory.CreateLog(this);

            _candlesSubcriber   = candlesSubscriber ?? throw new ArgumentNullException(nameof(candlesSubscriber));
            _snapshotSerializer = snapshotSerializer ?? throw new ArgumentNullException(nameof(snapshotSerializer));
            _persistenceQueueSnapshotRepository = persistenceQueueSnapshotRepository ?? throw new ArgumentNullException(nameof(persistenceQueueSnapshotRepository));
            _persistenceQueue   = persistenceQueue ?? throw new ArgumentNullException(nameof(persistenceQueue));
            _persistenceManager = persistenceManager ?? throw new ArgumentNullException(nameof(persistenceManager));
            _migrationManager   = migrationManager ?? throw new ArgumentNullException(nameof(migrationManager));
            _migrationEnabled   = migrationEnabled;
        }
示例#6
0
        public CandlesPersistenceManager(
            ICandlesPersistenceQueue persistenceQueue,
            IHealthService healthService,
            ILog log,
            PersistenceSettings settings) :
            base(nameof(CandlesPersistenceManager), (int)TimeSpan.FromSeconds(5).TotalMilliseconds, log)
        {
            _persistenceQueue = persistenceQueue;
            _healthService    = healthService;
            _settings         = settings;

            _lastDispatchMoment = DateTime.MinValue;
        }
示例#7
0
        public CandlesPersistenceManager(
            ICandlesPersistenceQueue persistenceQueue,
            IHealthService healthService,
            ILogFactory logFactory,
            PersistenceSettings settings) :

            base(TimeSpan.FromSeconds(5), logFactory, nameof(CandlesPersistenceManager))
        {
            _persistenceQueue = persistenceQueue;
            _healthService    = healthService;
            _settings         = settings;

            _lastDispatchMoment = DateTime.MinValue;
        }
 public StartupManager(
     ILog log,
     ICandlesCacheInitalizationService cacheInitalizationService,
     ICandlesSubscriber candlesSubscriber,
     ISnapshotSerializer snapshotSerializer,
     ICandlesPersistenceQueueSnapshotRepository persistenceQueueSnapshotRepository,
     ICandlesPersistenceQueue persistenceQueue,
     ICandlesPersistenceManager persistenceManager)
 {
     _log = log.CreateComponentScope(nameof(StartupManager));
     _cacheInitalizationService          = cacheInitalizationService;
     _candlesSubscriber                  = candlesSubscriber;
     _snapshotSerializer                 = snapshotSerializer;
     _persistenceQueueSnapshotRepository = persistenceQueueSnapshotRepository;
     _persistenceQueue   = persistenceQueue;
     _persistenceManager = persistenceManager;
 }
示例#9
0
 public ShutdownManager(
     ILog log,
     ICandlesSubscriber candlesSubscriber,
     ISnapshotSerializer snapshotSerializer,
     ICandlesPersistenceQueueSnapshotRepository persistenceQueueSnapshotRepository,
     ICandlesPersistenceQueue persistenceQueue,
     ICandlesPersistenceManager persistenceManager,
     CandlesMigrationManager migrationManager)
 {
     _log = log.CreateComponentScope(nameof(ShutdownManager));
     _candlesSubcriber   = candlesSubscriber;
     _snapshotSerializer = snapshotSerializer;
     _persistenceQueueSnapshotRepository = persistenceQueueSnapshotRepository;
     _persistenceQueue   = persistenceQueue;
     _persistenceManager = persistenceManager;
     _migrationManager   = migrationManager;
 }
        public CandlesMigrationManager(
            IHealthService healthService,
            MigrationCandlesGenerator candlesGenerator,
            IMissedCandlesGenerator missedCandlesGenerator,
            ICandlesHistoryMigrationService candlesHistoryMigrationService,
            ICandlesPersistenceQueue candlesPersistenceQueue,
            IAssetPairsManager assetPairsManager,
            ICandlesHistoryRepository candlesHistoryRepository,
            ILogFactory logFactory,
            MigrationSettings settings)
        {
            _candlesGenerator               = candlesGenerator;
            _missedCandlesGenerator         = missedCandlesGenerator;
            _candlesHistoryMigrationService = candlesHistoryMigrationService;
            _candlesPersistenceQueue        = candlesPersistenceQueue;
            _assetPairsManager              = assetPairsManager;
            _candlesHistoryRepository       = candlesHistoryRepository;
            _logFactory    = logFactory;
            _settings      = settings;
            _healthService = healthService;

            _assetManagers       = new Dictionary <string, AssetPairMigrationManager>();
            _assetHealthServices = new Dictionary <string, AssetPairMigrationTelemetryService>();
        }
示例#11
0
        public ShutdownManager(
            ILog log,
            ICandlesSubscriber candlesSubscriber,
            ISnapshotSerializer snapshotSerializer,
            ICandlesPersistenceQueueSnapshotRepository persistenceQueueSnapshotRepository,
            ICandlesPersistenceQueue persistenceQueue,
            ICandlesPersistenceManager persistenceManager,
            CandlesMigrationManager migrationManager,
            bool migrationEnabled)
        {
            if (log == null)
            {
                throw new ArgumentNullException(nameof(log));
            }
            _log = log.CreateComponentScope(nameof(ShutdownManager)) ?? throw new InvalidOperationException("Couldn't create a component scope for logging.");

            _candlesSubcriber   = candlesSubscriber ?? throw new ArgumentNullException(nameof(candlesSubscriber));
            _snapshotSerializer = snapshotSerializer ?? throw new ArgumentNullException(nameof(snapshotSerializer));
            _persistenceQueueSnapshotRepository = persistenceQueueSnapshotRepository ?? throw new ArgumentNullException(nameof(persistenceQueueSnapshotRepository));
            _persistenceQueue   = persistenceQueue ?? throw new ArgumentNullException(nameof(persistenceQueue));
            _persistenceManager = persistenceManager ?? throw new ArgumentNullException(nameof(persistenceManager));
            _migrationManager   = migrationManager ?? throw new ArgumentNullException(nameof(migrationManager));
            _migrationEnabled   = migrationEnabled;
        }