private static async Task RemoveKeysWithPrefixAsync( ITransaction tx, IReliableDictionary2 <string, byte[]> relDict, string keyPrefix, CancellationToken cancellationToken) { var enumerable = await relDict.CreateKeyEnumerableAsync(tx, EnumerationMode.Ordered); var enumerator = enumerable.GetAsyncEnumerator(); var canBreak = false; while (await enumerator.MoveNextAsync(cancellationToken)) { if (enumerator.Current.StartsWith(keyPrefix, StringComparison.OrdinalIgnoreCase)) { canBreak = true; await relDict.TryRemoveAsync(tx, enumerator.Current); } else { if (canBreak) { break; } } } }
public Task <IAsyncEnumerable <TKey> > CreateKeyEnumerableAsync(ITransaction tx) { return(_dictionary.CreateKeyEnumerableAsync(tx)); }
/// <summary> /// Create an async enumerable over the set of distinct filter values in this index. /// </summary> public Task <IAsyncEnumerable <TFilter> > CreateEnumerableAsync(ITransaction tx, EnumerationMode enumerationMode, TimeSpan timeout, CancellationToken token) { return(_index.CreateKeyEnumerableAsync(tx, enumerationMode, timeout, token)); }
public Task <IAsyncEnumerable <string> > CreateKeyEnumerableAsync(ITransaction tx) => _metadataStore.CreateKeyEnumerableAsync(tx, EnumerationMode.Unordered);