Inheritance: TableAutoscalingConfigurationSet, IAutoscalingConfigurationSet
        public async Task EnsureProvisioningAsync_ShouldCallUpdateOnClientWhenRequired()
        {
            var configurationSet = new GlobalSecondaryIndexAutoscalingConfigurationSet
            {
                TableName = tableName,
                DemoMode = false,
                Reads = new AutoscalingConfiguration { EnableAutoscaling = true },
                Writes = new AutoscalingConfiguration { EnableAutoscaling = true },
            };
            var provisioned = new DynamoDbTableThroughput { ReadThroughput = 500, WriteThroughput = 1000 };
            var updated = new DynamoDbTableThroughput { ReadThroughput = 500, WriteThroughput = 2000 };

            await indexProvisioner.ProvisionAsync(configurationSet, provisioned, updated);

            throughputClientMock.Verify(
                client => client.SetGlobalSecondaryIndexThroughputLevelAsync(tableName, indexName, 500, 2000, default(CancellationToken)),
                Times.Once);
        }
Exemplo n.º 2
0
        internal async Task EnsureGlobalSecondaryIndexProvisionAsync(
            bool isCircuitBreakerTripped,
            GlobalSecondaryIndexAutoscalingConfigurationSet configuration,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();

            var tableName = configuration.TableName;
            var indexName = configuration.IndexName;

            var provisioned = await throughputClient.GetGlobalSecondaryIndexThroughputLevelAsync(tableName, indexName, cancellationToken).ConfigureAwait(false);
            var metrics = await metricsClient.GetGlobalSecondaryIndexMetricsAsync(tableName, indexName, cancellationToken);
            LogStats(configuration, provisioned, metrics);

            var updated = EnsureProvision(isCircuitBreakerTripped, provisioned, metrics, configuration);
            var provisioner = new GlobalSecondaryIndexProvisioner(tableName, indexName, throughputClient, structuredLogger);
            await provisioner.ProvisionAsync(configuration, provisioned, updated, cancellationToken).ConfigureAwait(false);
        }
Exemplo n.º 3
0
        internal async Task EnsureAllGlobalSecondaryIndexProvisionAsync(
            bool isCircuitBreakerTripped,
            GlobalSecondaryIndexAutoscalingConfigurationSet configuration,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();

            var tableName = configuration.TableName;
            var indices = await throughputClient.FindAllGlobalSecondaryIndexThroughputLevelsAsync(tableName, cancellationToken).ConfigureAwait(false);
            foreach (var index in indices)
            {
                var indexConfiguration = new GlobalSecondaryIndexAutoscalingConfigurationSet(tableName, index.IndexName, configuration);
                await EnsureGlobalSecondaryIndexProvisionAsync(isCircuitBreakerTripped, indexConfiguration, cancellationToken).ConfigureAwait(false);
            }
        }