public async Task <DatabaseScavengeResult> StartScavengeAsync( int threadCount = 1, int startFromChunk = 0, UserCredentials userCredentials = default, CancellationToken cancellationToken = default) { if (threadCount <= 0) { throw new ArgumentOutOfRangeException(nameof(threadCount)); } if (startFromChunk < 0) { throw new ArgumentOutOfRangeException(nameof(startFromChunk)); } var result = await _client.StartScavengeAsync(new StartScavengeReq { Options = new StartScavengeReq.Types.Options { ThreadCount = threadCount, StartFromChunk = startFromChunk } }, RequestMetadata.Create(userCredentials), cancellationToken : cancellationToken); return(result.ScavengeResult switch { ScavengeResp.Types.ScavengeResult.Started => DatabaseScavengeResult.Started(result.ScavengeId), ScavengeResp.Types.ScavengeResult.Stopped => DatabaseScavengeResult.Stopped(result.ScavengeId), ScavengeResp.Types.ScavengeResult.InProgress => DatabaseScavengeResult.InProgress(result.ScavengeId), _ => throw new InvalidOperationException() });
public async Task stop() { var startResult = await _fixture.OperationsClient.StartScavengeAsync(userCredentials : TestCredentials.Root); var stopResult = await _fixture.OperationsClient .StopScavengeAsync(startResult.ScavengeId, TestCredentials.Root); Assert.Equal(DatabaseScavengeResult.Stopped(startResult.ScavengeId), stopResult); }
public async Task start() { var result = await _fixture.OperationsClient.StartScavengeAsync(userCredentials : TestCredentials.Root); Assert.Equal(DatabaseScavengeResult.Started(result.ScavengeId), result); }