/// <summary> /// See <seealso cref="#setMaxWriteMBPerSec"/>. /// </summary> /// <exception cref="ArgumentException"> /// if context is <code>null</code> </exception> /// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/> is already closed /// @lucene.experimental </exception> public double GetMaxWriteMBPerSec(IOContext.Context_e context) { EnsureOpen(); var limiter = GetRateLimiter(context); return(limiter == null ? 0 : limiter.MbPerSec); }
/// <summary> /// Sets the rate limiter to be used to limit (approx) MB/sec allowed by all IO /// performed with the given <seealso cref="IOContext.Context context"/>. Pass <code>null</code> to /// have no limit. /// /// <p> /// Passing an instance of rate limiter compared to setting it using /// <seealso cref="#setMaxWriteMBPerSec(Double, IOContext.Context)"/> /// allows to use the same limiter instance across several directories globally /// limiting IO across them. /// </summary> /// <exception cref="IllegalArgumentException"> /// if context is <code>null</code> </exception> /// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/> is already closed /// @lucene.experimental </exception> public void SetRateLimiter(RateLimiter mergeWriteRateLimiter, IOContext.Context_e context) { EnsureOpen(); if (context == null) { throw new System.ArgumentException("Context must not be null"); } ContextRateLimiters[context] = mergeWriteRateLimiter; }
/// <summary> /// See <seealso cref="#setMaxWriteMBPerSec"/>. /// </summary> /// <exception cref="IllegalArgumentException"> /// if context is <code>null</code> </exception> /// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/> is already closed /// @lucene.experimental </exception> public double GetMaxWriteMBPerSec(IOContext.Context_e context) { EnsureOpen(); if (context == null) { throw new System.ArgumentException("Context must not be null"); } RateLimiter limiter = GetRateLimiter(context); return(limiter == null ? 0 : limiter.MbPerSec); }
private RateLimiter GetRateLimiter(IOContext.Context_e context) { Debug.Assert(context != null); return(ContextRateLimiters[context]); }
/// <summary> /// Sets the rate limiter to be used to limit (approx) MB/sec allowed by all IO /// performed with the given <seealso cref="IOContext.Context context"/>. Pass <code>null</code> to /// have no limit. /// /// <p> /// Passing an instance of rate limiter compared to setting it using /// <seealso cref="#setMaxWriteMBPerSec(Double, IOContext.Context)"/> /// allows to use the same limiter instance across several directories globally /// limiting IO across them. /// </summary> /// <exception cref="ArgumentException"> /// if context is <code>null</code> </exception> /// <exception cref="AlreadyClosedException"> if the <seealso cref="Directory"/> is already closed /// @lucene.experimental </exception> public void SetRateLimiter(RateLimiter mergeWriteRateLimiter, IOContext.Context_e context) { EnsureOpen(); _contextRateLimiters[context] = mergeWriteRateLimiter; }