コード例 #1
0
        public override void Dispose()
        {
            if (_sourceClient != null)
            {
                _sourceClient.Dispose();
                _sourceClient = null;
            }
            if (_targetClient != null)
            {
                _targetClient.Dispose();
                _targetClient = null;
            }

            base.Dispose();
        }
コード例 #2
0
 public DocDbSyncWorker(
     IKeyVaultClient kvClient,
     IOptions <VaultSettings> vaultSettings,
     IOptionsSnapshot <DocDbSettings> source,
     IOptionsSnapshot <DocDbSettings> target,
     IOptions <DataSyncSettings> syncSettings,
     ILoggerFactory loggerFactory,
     TelemetryClient telemetry)
 {
     _source       = source.Get("source");
     _sourceClient = new DocumentDbClient(kvClient, vaultSettings, _source, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry);
     _target       = target.Get("target");
     _targetClient = new DocumentDbClient(kvClient, vaultSettings, _target, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry);
     _syncSettings = syncSettings.Value;
     _logger       = loggerFactory.CreateLogger <DocDbSyncWorker>();
     _telemetry    = telemetry;
 }
コード例 #3
0
        public CopyCollectionsWorker(
            IKeyVaultClient kvClient,
            IOptions <VaultSettings> vaultSettings,
            IOptions <CopyCollectionsSettings> settings,
            ILoggerFactory loggerFactory,
            TelemetryClient telemetry)
        {
            _settings  = settings.Value;
            _logger    = loggerFactory.CreateLogger <CopyCollectionsWorker>();
            _telemetry = telemetry;

            _sourceClient = new DocumentDbClient(kvClient, vaultSettings, _settings.Source,
                                                 loggerFactory.CreateLogger <DocumentDbClient>(), telemetry);
            _targetClient = new DocumentDbClient(kvClient, vaultSettings, _settings.Target,
                                                 loggerFactory.CreateLogger <DocumentDbClient>(), telemetry);

            _ru       = _telemetry.GetMetric("bulk_executor_ru", "collection_name");
            _docCount = _telemetry.GetMetric("bulk_executor_docs", "collection_name");
            _latency  = _telemetry.GetMetric("bulk_executor_latency", "collection_name");
            _error    = _telemetry.GetMetric("bulk_executor_errors", "collection_name");
        }
コード例 #4
0
        public DocDbBulkSyncWorker(
            IKeyVaultClient kvClient,
            IOptions <VaultSettings> vaultSettings,
            IOptionsSnapshot <DocDbSettings> source,
            IOptionsSnapshot <DocDbSettings> target,
            IOptions <DataSyncSettings> syncSettings,
            ILoggerFactory loggerFactory,
            TelemetryClient telemetry)
        {
            _source       = source.Get("source");
            _sourceClient = new DocumentDbClient(kvClient, vaultSettings, _source, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry);
            _target       = target.Get("target");
            _targetClient = new DocumentDbClient(kvClient, vaultSettings, _target, loggerFactory.CreateLogger <DocumentDbClient>(), telemetry);
            _syncSettings = syncSettings.Value;
            _logger       = loggerFactory.CreateLogger <DocDbBulkSyncWorker>();
            _telemetry    = telemetry;

            _ru       = _telemetry.GetMetric("bulk_executor_ru", "operation_name");
            _docCount = _telemetry.GetMetric("bulk_executor_docs", "operation_name");
            _latency  = _telemetry.GetMetric("bulk_executor_latency", "operation_name");
            _error    = _telemetry.GetMetric("bulk_executor_errors", "operation_name");
        }
コード例 #5
0
 public CreateSimulateGoalHandler(IDocumentDbClient client)
 {
     _client = client;
 }
コード例 #6
0
 public CartRepository(IDocumentDbClient <CartItem> dbClient)
 {
     _dbClient = dbClient ?? throw new ArgumentNullException(nameof(dbClient));
 }
コード例 #7
0
        public void CartRepository_WithNullArgument_ShouldThrowNullException(IDocumentDbClient <CartItem> dbClient, string paramName)
        {
            var except = Assert.Throws <ArgumentNullException>(() => new CartRepository(dbClient));

            Assert.Equal(paramName, except.ParamName);
        }