public async Task <Operation> CompactDatabaseAsync(string databaseName, CancellationToken token = default(CancellationToken)) { using (var req = adminRequest.CompactDatabase(databaseName)) { var json = await req.ReadResponseJsonAsync().WithCancellation(token).ConfigureAwait(false); return(new Operation((AsyncServerClient)innerAsyncServerClient.ForSystemDatabase(), json.Value <long>("OperationId"))); } }
public async Task EnsureDatabaseExistsAsync(string name, bool ignoreFailures = false) { var serverClient = (AsyncServerClient)(innerAsyncServerClient.ForSystemDatabase()); var doc = MultiDatabase.CreateDatabaseDocument(name); serverClient.ForceReadFromMaster(); var get = await serverClient.GetAsync(doc.Id).ConfigureAwait(false); if (get != null) { return; } try { await serverClient.GlobalAdmin.CreateDatabaseAsync(doc).ConfigureAwait(false); } catch (Exception) { if (ignoreFailures == false) { throw; } } await new RavenDocumentsByEntityName().ExecuteAsync(serverClient.ForDatabase(name), new DocumentConvention()).ConfigureAwait(false); }
public AsyncAdminServerClient(AsyncServerClient asyncServerClient) { innerAsyncServerClient = asyncServerClient; adminRequest = new AdminRequestCreator((url, method) => innerAsyncServerClient.ForSystemDatabase().CreateRequest(url, method), (currentServerUrl, requestUrl, method) => innerAsyncServerClient.CreateReplicationAwareRequest(currentServerUrl, requestUrl, method)); }
public AsyncAdminServerClient(AsyncServerClient asyncServerClient) { innerAsyncServerClient = asyncServerClient; adminRequest = new AdminRequestCreator((url, method) => innerAsyncServerClient.ForSystemDatabase().CreateRequest(url, method), (url, method) => innerAsyncServerClient.CreateRequest(url, method), (currentServerUrl, requestUrl, method) => innerAsyncServerClient.CreateReplicationAwareRequest(currentServerUrl, requestUrl, method)); }