/// <summary>Return the keys that are in the first range, but not in the others</summary> /// <typeparam name="TKey">Type of the keys returned by the query</typeparam> /// <param name="trans">Transaction used by the operation</param> /// <param name="ranges">List of at least one key selector pairs</param> /// <param name="keySelector">Lambda called to extract the keys from the ranges</param> /// <param name="keyComparer">Instance used to compare the keys returned by <paramref name="keySelector"/></param> /// <returns>Async query that returns only the results that are in the first range, and not in any other range.</returns> public static IFdbAsyncEnumerable <KeyValuePair <Slice, Slice> > Except <TKey>(this IFdbReadOnlyTransaction trans, IEnumerable <FdbKeySelectorPair> ranges, Func <KeyValuePair <Slice, Slice>, TKey> keySelector, IComparer <TKey> keyComparer = null) { //TODO: Range options ? if (trans == null) { throw new ArgumentNullException("trans"); } if (ranges == null) { throw new ArgumentNullException("ranges"); } if (keySelector == null) { throw new ArgumentNullException("keySelector"); } trans.EnsureCanRead(); return(new FdbExceptIterator <KeyValuePair <Slice, Slice>, TKey, KeyValuePair <Slice, Slice> >( ranges.Select(range => trans.GetRange(range, new FdbRangeOptions { Mode = FdbStreamingMode.Iterator })), default(int?), keySelector, TaskHelpers.Cache <KeyValuePair <Slice, Slice> > .Identity, keyComparer )); }
public static IAsyncEnumerable <KeyValuePair <Slice, Slice> > MergeSort <TKey>([NotNull] this IFdbReadOnlyTransaction trans, [NotNull] IEnumerable <KeySelectorPair> ranges, [NotNull] Func <KeyValuePair <Slice, Slice>, TKey> keySelector, IComparer <TKey> keyComparer = null) { //TODO: Range options ? Contract.NotNull(trans, nameof(trans)); Contract.NotNull(ranges, nameof(ranges)); Contract.NotNull(keySelector, nameof(keySelector)); trans.EnsureCanRead(); return(new MergeSortAsyncIterator <KeyValuePair <Slice, Slice>, TKey, KeyValuePair <Slice, Slice> >( ranges.Select(range => trans.GetRange(range, new FdbRangeOptions { Mode = FdbStreamingMode.Iterator })),
public static IFdbAsyncEnumerable <TResult> MergeSort <TKey, TResult>(this IFdbReadOnlyTransaction trans, IEnumerable <FdbKeySelectorPair> ranges, Func <KeyValuePair <Slice, Slice>, TKey> keySelector, Func <KeyValuePair <Slice, Slice>, TResult> resultSelector, IComparer <TKey> keyComparer = null) { //TODO: Range options ? trans.EnsureCanRead(); return(new FdbMergeSortIterator <KeyValuePair <Slice, Slice>, TKey, TResult>( ranges.Select(range => trans.GetRange(range, new FdbRangeOptions { Mode = FdbStreamingMode.Iterator })), default(int?), keySelector, resultSelector, keyComparer )); }
public static IFdbAsyncEnumerable <KeyValuePair <Slice, Slice> > Except <TKey>([NotNull] this IFdbReadOnlyTransaction trans, IEnumerable <KeySelectorPair> ranges, Func <KeyValuePair <Slice, Slice>, TKey> keySelector, IComparer <TKey> keyComparer = null) { //TODO: Range options ? Contract.NotNull(trans, nameof(trans)); Contract.NotNull(ranges, nameof(ranges)); Contract.NotNull(keySelector, nameof(keySelector)); trans.EnsureCanRead(); return(new FdbExceptIterator <KeyValuePair <Slice, Slice>, TKey, KeyValuePair <Slice, Slice> >( ranges.Select(range => trans.GetRange(range, new FdbRangeOptions { Mode = FdbStreamingMode.Iterator })), default(int?), keySelector, (kv) => kv, keyComparer )); }
public void EnsureCanRead() { m_transaction.EnsureCanRead(); }