]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/java/src/main/java/org/rocksdb/WriteBufferManager.java
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / WriteBufferManager.java
index b244aa9522d70e214b76b6d33dd0a51d7f147c5f..8ec9639586ca8d352af188ecc9f50da82ae58956 100644 (file)
@@ -22,12 +22,29 @@ public class WriteBufferManager extends RocksObject {
    *
    * @param bufferSizeBytes buffer size(in bytes) to use for native write_buffer_manager
    * @param cache cache whose memory should be bounded by this write buffer manager
+   * @param allowStall if set true, it will enable stalling of writes when memory_usage() exceeds
+   *     buffer_size.
+   *        It will wait for flush to complete and memory usage to drop down.
    */
+  public WriteBufferManager(
+      final long bufferSizeBytes, final Cache cache, final boolean allowStall) {
+    super(newWriteBufferManager(bufferSizeBytes, cache.nativeHandle_, allowStall));
+    this.allowStall_ = allowStall;
+  }
+
   public WriteBufferManager(final long bufferSizeBytes, final Cache cache){
-    super(newWriteBufferManager(bufferSizeBytes, cache.nativeHandle_));
+    this(bufferSizeBytes, cache, false);
+  }
+
+  public boolean allowStall() {
+    return allowStall_;
   }
 
-  private native static long newWriteBufferManager(final long bufferSizeBytes, final long cacheHandle);
+  private native static long newWriteBufferManager(
+      final long bufferSizeBytes, final long cacheHandle, final boolean allowStall);
+
   @Override
   protected native void disposeInternal(final long handle);
+
+  private boolean allowStall_;
 }