Format async io for Java API (#12192)

Summary:
Format https://github.com/facebook/rocksdb/issues/12184  according to adamretter 's comments.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/12192

Reviewed By: cbi42

Differential Revision: D52457427

Pulled By: ajkr

fbshipit-source-id: 75b1be5d89687be4e58e618d693a6a120c5efc78
This commit is contained in:
haobo sun 2024-01-02 13:19:08 -08:00 committed by Facebook GitHub Bot
parent d411fc4dd6
commit 09411e199d
3 changed files with 16 additions and 18 deletions

View File

@ -8624,20 +8624,20 @@ void Java_org_rocksdb_ReadOptions_setValueSizeSoftLimit(
/*
* Class: org_rocksdb_ReadOptions
* Method: asyncIO
* Method: asyncIo
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_ReadOptions_asyncIO(JNIEnv*, jobject, jlong jhandle) {
jboolean Java_org_rocksdb_ReadOptions_asyncIo(JNIEnv*, jobject, jlong jhandle) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::ReadOptions*>(jhandle);
return static_cast<jboolean>(opt->async_io);
}
/*
* Class: org_rocksdb_ReadOptions
* Method: setAsyncIO
* Method: setAsyncIo
* Signature: (JZ)V
*/
void Java_org_rocksdb_ReadOptions_setAsyncIO(JNIEnv*, jobject, jlong jhandle,
void Java_org_rocksdb_ReadOptions_setAsyncIo(JNIEnv*, jobject, jlong jhandle,
jboolean jasync_io) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::ReadOptions*>(jhandle);
opt->async_io = static_cast<bool>(jasync_io);

View File

@ -751,8 +751,6 @@ public class ReadOptions extends RocksObject {
}
/**
* Experimental
* <p>
* If async_io is enabled, RocksDB will prefetch some of data asynchronously.
* RocksDB apply it if reads are sequential and its internal automatic
* prefetching.
@ -760,24 +758,24 @@ public class ReadOptions extends RocksObject {
* Default: false
* @return true if async_io is enabled.
*/
public boolean asyncIO() {
@Experimental("Caution: this option is experimental")
public boolean asyncIo() {
assert (isOwningHandle());
return asyncIO(nativeHandle_);
return asyncIo(nativeHandle_);
}
/**
* Experimental
* <p>
* If async_io is enabled, RocksDB will prefetch some of data asynchronously.
* RocksDB apply it if reads are sequential and its internal automatic
* prefetching.
* <p>
* @param asyncIO async_io enabled or not.
* @param asyncIo async_io enabled or not.
* @return the reference to the current ReadOptions.
*/
public ReadOptions setAsyncIO(final boolean asyncIO) {
@Experimental("Caution: this option is experimental")
public ReadOptions setAsyncIo(final boolean asyncIo) {
assert (isOwningHandle());
setAsyncIO(nativeHandle_, asyncIO);
setAsyncIo(nativeHandle_, asyncIo);
return this;
}
@ -848,6 +846,6 @@ public class ReadOptions extends RocksObject {
private native void setIoTimeout(final long handle, final long ioTimeout);
private native long valueSizeSoftLimit(final long handle);
private native void setValueSizeSoftLimit(final long handle, final long softLimit);
private native boolean asyncIO(final long handle);
private native void setAsyncIO(final long handle, final boolean asyncIO);
private native boolean asyncIo(final long handle);
private native void setAsyncIo(final long handle, final boolean asyncIO);
}

View File

@ -256,10 +256,10 @@ public class ReadOptionsTest {
}
@Test
public void asyncIO() {
public void asyncIo() {
try (final ReadOptions opt = new ReadOptions()) {
opt.setAsyncIO(true);
assertThat(opt.asyncIO()).isTrue();
opt.setAsyncIo(true);
assertThat(opt.asyncIo()).isTrue();
}
}