Exemplo n.º 1
0
        public Task <IEnumerable <TKey> > RangeFromFilterKeysOnlyAsync <TFilter>(ITransaction tx, string indexName, TFilter startFilter, RangeFilterType startType, TimeSpan timeout, CancellationToken token)
            where TFilter : IComparable <TFilter>, IEquatable <TFilter>
        {
            // Find the index.
            var index = GetFilterableIndex <TFilter>(indexName);

            // Find the keys from the start value (inclusively or exclusively) to the end.
            return(index.RangeFromFilterAsync(tx, startFilter, startType, token));
        }
Exemplo n.º 2
0
        public Task <IEnumerable <TKey> > RangeFilterKeysOnlyAsync <TFilter>(ITransaction tx, string indexName, TFilter startFilter, RangeFilterType startType, TFilter endFilter, RangeFilterType endType, TimeSpan timeout, CancellationToken token)
            where TFilter : IComparable <TFilter>, IEquatable <TFilter>
        {
            // Find the index.
            var index = GetFilterableIndex <TFilter>(indexName);

            // Find the keys that fall within this range (inclusively).
            return(index.RangeFilterAsync(tx, startFilter, startType, endFilter, endType, token));
        }
Exemplo n.º 3
0
        public async Task <IAsyncEnumerable <KeyValuePair <TKey, TValue> > > RangeFromFilterAsync <TFilter>(ITransaction tx, string indexName, TFilter startFilter, RangeFilterType startType, TimeSpan timeout, CancellationToken token) where TFilter : IComparable <TFilter>, IEquatable <TFilter>
        {
            // Find the index.
            var index = GetFilterableIndex <TFilter>(indexName);

            // Find the keys from the start value (inclusively or exclusively) to the end.
            var keys = await index.RangeFromFilterAsync(tx, startFilter, startType, token).ConfigureAwait(false);

            // Get the rows that match this filter.
            return(GetAllAsync(tx, keys, timeout, token));
        }
Exemplo n.º 4
0
 public Task <IAsyncEnumerable <KeyValuePair <TKey, TValue> > > RangeFilterAsync <TFilter>(ITransaction tx, string index, TFilter startFilter, RangeFilterType startType, TFilter endFilter, RangeFilterType endType)
     where TFilter : IComparable <TFilter>, IEquatable <TFilter>
 {
     return(RangeFilterAsync(tx, index, startFilter, startType, endFilter, endType, DefaultTimeout, CancellationToken.None));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Retrieves all keys that fall in the given filter range, or an empty array if there are no matches.
 /// </summary>
 public Task <IEnumerable <TKey> > RangeFilterAsync(ITransaction tx, TFilter start, RangeFilterType startType, TFilter end, RangeFilterType endType, CancellationToken token)
 {
     if (startType == RangeFilterType.Inclusive && endType == RangeFilterType.Inclusive)
     {
         return(RangeFilterHelper(tx, f => start.CompareTo(f) <= 0 && f.CompareTo(end) <= 0, token));
     }
     else if (startType == RangeFilterType.Exclusive && endType == RangeFilterType.Inclusive)
     {
         return(RangeFilterHelper(tx, f => start.CompareTo(f) < 0 && f.CompareTo(end) <= 0, token));
     }
     else if (startType == RangeFilterType.Inclusive && endType == RangeFilterType.Exclusive)
     {
         return(RangeFilterHelper(tx, f => start.CompareTo(f) <= 0 && f.CompareTo(end) < 0, token));
     }
     else if (startType == RangeFilterType.Exclusive && endType == RangeFilterType.Exclusive)
     {
         return(RangeFilterHelper(tx, f => start.CompareTo(f) < 0 && f.CompareTo(end) < 0, token));
     }
     else
     {
         throw new NotSupportedException("Impossible state, must be Inclusive / Exclusive matrix");
     }
 }
Exemplo n.º 6
0
 public Task <IEnumerable <TKey> > RangeToFilterAsync(ITransaction tx, TFilter end, RangeFilterType endType, CancellationToken token)
 {
     if (endType == RangeFilterType.Inclusive)
     {
         return(RangeFilterHelper(tx, f => f.CompareTo(end) <= 0, token));
     }
     else if (endType == RangeFilterType.Exclusive)
     {
         return(RangeFilterHelper(tx, f => f.CompareTo(end) < 0, token));
     }
     else
     {
         throw new NotSupportedException("Impossible state, must be either Inclusive or Exclusive");
     }
 }