internal FdbRangeQuery <KeyValuePair <Slice, Slice> > GetRangeCore(KeySelector begin, KeySelector end, FdbRangeOptions options, bool snapshot)
        {
            this.Database.EnsureKeyIsValid(begin.Key);
            this.Database.EnsureKeyIsValid(end.Key, endExclusive: true);

            options = FdbRangeOptions.EnsureDefaults(options, null, null, FdbStreamingMode.Iterator, false);
            options.EnsureLegalValues();

#if DEBUG
            if (Logging.On && Logging.IsVerbose)
            {
                Logging.Verbose(this, "GetRangeCore", String.Format("Getting range '{0} <= x < {1}'", begin.ToString(), end.ToString()));
            }
#endif

            return(new FdbRangeQuery <KeyValuePair <Slice, Slice> >(this, begin, end, (kv) => kv, snapshot, options));
        }
        /// <summary>
        /// Reads all key-value pairs in the database snapshot represented by transaction (potentially limited by limit, target_bytes, or mode)
        /// which have a key lexicographically greater than or equal to the key resolved by the begin key selector
        /// and lexicographically less than the key resolved by the end key selector.
        /// </summary>
        /// <param name="beginInclusive">key selector defining the beginning of the range</param>
        /// <param name="endExclusive">key selector defining the end of the range</param>
        /// <param name="options">Optionnal query options (Limit, TargetBytes, StreamingMode, Reverse, ...)</param>
        /// <param name="iteration">If streaming mode is FdbStreamingMode.Iterator, this parameter should start at 1 and be incremented by 1 for each successive call while reading this range. In all other cases it is ignored.</param>
        /// <returns></returns>
        public Task <FdbRangeChunk> GetRangeAsync(KeySelector beginInclusive, KeySelector endExclusive, FdbRangeOptions options = null, int iteration = 0)
        {
            EnsureCanRead();

            m_database.EnsureKeyIsValid(beginInclusive.Key);
            m_database.EnsureKeyIsValid(endExclusive.Key, endExclusive: true);

            options = FdbRangeOptions.EnsureDefaults(options, null, null, FdbStreamingMode.Iterator, false);
            options.EnsureLegalValues();

            // The iteration value is only needed when in iterator mode, but then it should start from 1
            if (iteration == 0)
            {
                iteration = 1;
            }

            return(m_handler.GetRangeAsync(beginInclusive, endExclusive, options, iteration, snapshot: false, cancellationToken: m_cancellation));
        }
Ejemplo n.º 3
0
            /// <inheritdoc />
            public Task <FdbRangeChunk> GetRangeAsync(KeySelector beginInclusive,
                                                      KeySelector endExclusive,
                                                      int limit             = 0,
                                                      bool reverse          = false,
                                                      int targetBytes       = 0,
                                                      FdbStreamingMode mode = FdbStreamingMode.Exact,
                                                      FdbReadMode read      = FdbReadMode.Both,
                                                      int iteration         = 0)
            {
                EnsureCanRead();

                FdbKey.EnsureKeyIsValid(beginInclusive.Key);
                FdbKey.EnsureKeyIsValid(endExclusive.Key, endExclusive: true);

                FdbRangeOptions.EnsureLegalValues(limit, targetBytes, mode, read, iteration);

                // The iteration value is only needed when in iterator mode, but then it should start from 1
                if (iteration == 0)
                {
                    iteration = 1;
                }

                return(m_parent.PerformGetRangeOperation(beginInclusive, endExclusive, snapshot: true, limit, reverse, targetBytes, mode, read, iteration));
            }
Ejemplo n.º 4
0
		internal FdbRangeQuery<KeyValuePair<Slice, Slice>> GetRangeCore(FdbKeySelector begin, FdbKeySelector end, FdbRangeOptions options, bool snapshot)
		{
			this.Database.EnsureKeyIsValid(begin.Key);
			this.Database.EnsureKeyIsValid(end.Key, endExclusive: true);

			options = FdbRangeOptions.EnsureDefaults(options, null, null, FdbStreamingMode.Iterator, false);
			options.EnsureLegalValues();

#if DEBUG
			if (Logging.On && Logging.IsVerbose) Logging.Verbose(this, "GetRangeCore", String.Format("Getting range '{0} <= x < {1}'", begin.ToString(), end.ToString()));
#endif

			return new FdbRangeQuery<KeyValuePair<Slice, Slice>>(this, begin, end, TaskHelpers.Cache<KeyValuePair<Slice, Slice>>.Identity, snapshot, options);
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Reads all key-value pairs in the database snapshot represented by transaction (potentially limited by limit, target_bytes, or mode)
		/// which have a key lexicographically greater than or equal to the key resolved by the begin key selector
		/// and lexicographically less than the key resolved by the end key selector.
		/// </summary>
		/// <param name="beginInclusive">key selector defining the beginning of the range</param>
		/// <param name="endExclusive">key selector defining the end of the range</param>
		/// <param name="options">Optionnal query options (Limit, TargetBytes, StreamingMode, Reverse, ...)</param>
		/// <param name="iteration">If streaming mode is FdbStreamingMode.Iterator, this parameter should start at 1 and be incremented by 1 for each successive call while reading this range. In all other cases it is ignored.</param>
		/// <returns></returns>
		public Task<FdbRangeChunk> GetRangeAsync(FdbKeySelector beginInclusive, FdbKeySelector endExclusive, FdbRangeOptions options = null, int iteration = 0)
		{
			EnsureCanRead();

			m_database.EnsureKeyIsValid(beginInclusive.Key);
			m_database.EnsureKeyIsValid(endExclusive.Key, endExclusive: true);

			options = FdbRangeOptions.EnsureDefaults(options, null, null, FdbStreamingMode.Iterator, false);
			options.EnsureLegalValues();

			// The iteration value is only needed when in iterator mode, but then it should start from 1
			if (iteration == 0) iteration = 1;

			return m_handler.GetRangeAsync(beginInclusive, endExclusive, options, iteration, snapshot: false, cancellationToken: m_cancellation);
		}