/// <inheritdoc/> public void Dispose() { if (_cancellationTokenSource != null) { _cancellationTokenSource.Cancel(false); _cancellationTokenSource.Dispose(); _cancellationTokenSource = null; } if (_cas == 0) { // Never locked return; } var key = LockDocument.GetKey(Name); _collection.RemoveAsync(key, new RemoveOptions().Cas(_cas)) .ContinueWith(t => { if (t.Exception !.InnerExceptions.OfType <DocumentNotFoundException>().Any()) { _logger.LogDebug("Did not release lock '{name}' for holder '{holder}' because it was already released.", Name, Holder); }
public static Task RemoveAsync(this ICouchbaseCollection collection, string id, Action <RemoveOptions> configureOptions) { var options = new RemoveOptions(); configureOptions(options); return(collection.RemoveAsync(id, options)); }
public async Task Teardown() { foreach (var key in _documentsToDelete) { await _collection.RemoveAsync(key); } await _cluster.DisposeAsync(); }
private static async Task RemoveAsync(string id, ICouchbaseCollection collection) { try { await collection.RemoveAsync(id); } catch (DocumentNotFoundException) { } }
public async Task Teardown() { DocumentsToRemove.ForEach(async key => { try { await Collection.RemoveAsync(key); } catch { // if there's an exception throw because that key doesn't exist // that's fine, but there many be others in DocumentsToRemove // so that's why this exception is being swallowed } }); await TestCluster.DisposeAsync(); }
private static async Task DeleteDocument(ICouchbaseCollection collection, string documentId) { await collection.RemoveAsync(documentId); }
public async Task UnstageRemove(ICouchbaseCollection collection, string docId, ulong cas = 0) { var opts = new RemoveOptions().Defaults(_durability, _keyValueTimeout).Cas(cas); await collection.RemoveAsync(docId, opts).CAF(); }
public static Task RemoveAsync(this ICouchbaseCollection collection, string id) { return(collection.RemoveAsync(id, RemoveOptions.Default)); }
public static IAsyncDisposable RemoveDocument(ICouchbaseCollection collection, string docId, ITestOutputHelper outputHelper) { return(new DisposeCleanerAsync(() => collection.RemoveAsync(docId), outputHelper)); }
public async Task GlobalCleanup() { await _collection.RemoveAsync(_key).ConfigureAwait(false); _cluster.Dispose(); }