Class LimitingRebufferer

java.lang.Object
org.apache.cassandra.io.util.WrappingRebufferer
org.apache.cassandra.io.util.LimitingRebufferer
All Implemented Interfaces:
AutoCloseable, ReaderFileProxy, Rebufferer, Rebufferer.BufferHolder

@NotThreadSafe public class LimitingRebufferer extends WrappingRebufferer
Rebufferer wrapper that applies rate limiting.

Instantiated once per RandomAccessReader, thread-unsafe. The instances reuse themselves as the BufferHolder to avoid having to return a new object for each rebuffer call. Only one BufferHolder can be active at a time. Calling rebuffer(long) before the previously obtained buffer holder is released will throw AssertionError.

  • Constructor Details

    • LimitingRebufferer

      public LimitingRebufferer(Rebufferer wrapped, com.google.common.util.concurrent.RateLimiter limiter, int limitQuant)
  • Method Details

    • rebuffer

      public Rebufferer.BufferHolder rebuffer(long position)
      Description copied from interface: Rebufferer
      Rebuffer (move on or seek to) a given position, and return a buffer that can be used there. The only guarantee about the size of the returned data is that unless rebuffering at the end of the file, the buffer will not be empty and will contain the requested position, i.e. offset <= position < offset + bh.buffer().limit(), but the buffer will not be positioned there.
      Specified by:
      rebuffer in interface Rebufferer
      Overrides:
      rebuffer in class WrappingRebufferer
    • toString

      public String toString()
      Overrides:
      toString in class WrappingRebufferer