Class ThrottleLayer

java.lang.Object
org.apache.opendal.Layer
org.apache.opendal.layer.ThrottleLayer

public class ThrottleLayer extends Layer
Limits bandwidth for bounded read ranges and write buffers. A range or buffer larger than the configured burst fails with OpenDALException.Code.RateLimited.
See Also:
  • Constructor Details

    • ThrottleLayer

      public ThrottleLayer(long bandwidth, long burst)
      Creates a bandwidth limiter.
      Parameters:
      bandwidth - the number of bytes allowed per second
      burst - the number of bytes allowed in a single burst
      Throws:
      IllegalArgumentException - if either argument is outside 1 through 4,294,967,295 (inclusive)
  • Method Details

    • layer

      protected long layer(long nativeOp)
      Specified by:
      layer in class Layer