internal RateLimitedIndexOutput(RateLimiter rateLimiter, IndexOutput @delegate)
 {
     // TODO should we make buffer size configurable
     if (@delegate is BufferedIndexOutput)
     {
         bufferedDelegate = (BufferedIndexOutput)@delegate;
         this.@delegate   = @delegate;
     }
     else
     {
         this.@delegate   = @delegate;
         bufferedDelegate = null;
     }
     this.rateLimiter = rateLimiter;
 }
Esempio n. 2
0
 /// <summary>
 /// Sets the rate limiter to be used to limit (approx) MB/sec allowed by all IO
 /// performed with the given context (<see cref="IOContext.UsageContext"/>). Pass <c>null</c> to
 /// have no limit.
 ///
 /// <para/>
 /// Passing an instance of rate limiter compared to setting it using
 /// <see cref="SetMaxWriteMBPerSec(double?, IOContext.UsageContext)"/>
 /// allows to use the same limiter instance across several directories globally
 /// limiting IO across them.
 /// <para/>
 /// @lucene.experimental
 /// </summary>
 /// <exception cref="ObjectDisposedException"> if the <see cref="Directory"/> is already disposed
 /// </exception>
 public void SetRateLimiter(RateLimiter mergeWriteRateLimiter, IOContext.UsageContext context)
 {
     EnsureOpen();
     _contextRateLimiters[context] = mergeWriteRateLimiter;
 }