add setMaxTableFilesSize to JNI interface

This commit is contained in:
Jesper Lundgren 2015-06-20 16:23:22 +08:00
parent 3bdec09cb7
commit d62b6ed838
4 changed files with 97 additions and 0 deletions

View file

@ -1134,6 +1134,27 @@ jbyte Java_org_rocksdb_Options_compactionStyle(
return reinterpret_cast<rocksdb::Options*>(jhandle)->compaction_style; return reinterpret_cast<rocksdb::Options*>(jhandle)->compaction_style;
} }
/*
* Class: org_rocksdb_Options
* Method: setMaxTableFilesSizeFIFO
* Signature: (JJ)V
*/
void Java_org_rocksdb_Options_setMaxTableFilesSizeFIFO(
JNIEnv* env, jobject jobj, jlong jhandle, jlong jmax_table_files_size) {
reinterpret_cast<rocksdb::Options*>(jhandle)->compaction_options_fifo.max_table_files_size =
static_cast<long>(jmax_table_files_size);
}
/*
* Class: org_rocksdb_Options
* Method: maxTableFilesSizeFIFO
* Signature: (J)J
*/
jlong Java_org_rocksdb_Options_maxTableFilesSizeFIFO(
JNIEnv* env, jobject jobj, jlong jhandle) {
return reinterpret_cast<rocksdb::Options*>(jhandle)->compaction_options_fifo.max_table_files_size;
}
/* /*
* Class: org_rocksdb_Options * Class: org_rocksdb_Options
* Method: numLevels * Method: numLevels
@ -2271,6 +2292,27 @@ jbyte Java_org_rocksdb_ColumnFamilyOptions_compactionStyle(
(jhandle)->compaction_style; (jhandle)->compaction_style;
} }
/*
* Class: org_rocksdb_ColumnFamilyOptions
* Method: setMaxTableFilesSizeFIFO
* Signature: (JJ)V
*/
void Java_org_rocksdb_ColumnFamilyOptions_setMaxTableFilesSizeFIFO(
JNIEnv* env, jobject jobj, jlong jhandle, jlong jmax_table_files_size) {
reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->compaction_options_fifo.max_table_files_size =
static_cast<long>(jmax_table_files_size);
}
/*
* Class: org_rocksdb_ColumnFamilyOptions
* Method: maxTableFilesSizeFIFO
* Signature: (J)J
*/
jlong Java_org_rocksdb_ColumnFamilyOptions_maxTableFilesSizeFIFO(
JNIEnv* env, jobject jobj, jlong jhandle) {
return reinterpret_cast<rocksdb::ColumnFamilyOptions*>(jhandle)->compaction_options_fifo.max_table_files_size;
}
/* /*
* Class: org_rocksdb_ColumnFamilyOptions * Class: org_rocksdb_ColumnFamilyOptions
* Method: numLevels * Method: numLevels

View file

@ -468,6 +468,20 @@ public class ColumnFamilyOptions extends RocksObject
return CompactionStyle.values()[compactionStyle(nativeHandle_)]; return CompactionStyle.values()[compactionStyle(nativeHandle_)];
} }
@Override
public ColumnFamilyOptions setMaxTableFilesSizeFIFO(
final long maxTableFilesSize) {
assert(maxTableFilesSize > 0); // unsigned native type
assert(isInitialized());
setMaxTableFilesSizeFIFO(nativeHandle_, maxTableFilesSize);
return this;
}
@Override
public long maxTableFilesSizeFIFO() {
return maxTableFilesSizeFIFO(nativeHandle_);
}
@Override @Override
public ColumnFamilyOptions setVerifyChecksumsInCompaction( public ColumnFamilyOptions setVerifyChecksumsInCompaction(
final boolean verifyChecksumsInCompaction) { final boolean verifyChecksumsInCompaction) {
@ -740,6 +754,9 @@ public class ColumnFamilyOptions extends RocksObject
private native boolean disableAutoCompactions(long handle); private native boolean disableAutoCompactions(long handle);
private native void setCompactionStyle(long handle, byte compactionStyle); private native void setCompactionStyle(long handle, byte compactionStyle);
private native byte compactionStyle(long handle); private native byte compactionStyle(long handle);
private native void setMaxTableFilesSizeFIFO(
long handle, long max_table_files_size);
private native long maxTableFilesSizeFIFO(long handle);
private native void setPurgeRedundantKvsWhileFlush( private native void setPurgeRedundantKvsWhileFlush(
long handle, boolean purgeRedundantKvsWhileFlush); long handle, boolean purgeRedundantKvsWhileFlush);
private native boolean purgeRedundantKvsWhileFlush(long handle); private native boolean purgeRedundantKvsWhileFlush(long handle);

View file

@ -837,6 +837,27 @@ public interface ColumnFamilyOptionsInterface {
*/ */
CompactionStyle compactionStyle(); CompactionStyle compactionStyle();
/**
* FIFO compaction option.
* The oldest table file will be deleted
* once the sum of table files reaches this size.
* The default value is 1GB (1 * 1024 * 1024 * 1024).
*
* @param maxTableFilesSize the size limit of the total sum of table files.
* @return the instance of the current Object.
*/
Object setMaxTableFilesSizeFIFO(long maxTableFilesSize);
/**
* FIFO compaction option.
* The oldest table file will be deleted
* once the sum of table files reaches this size.
* The default value is 1GB (1 * 1024 * 1024 * 1024).
*
* @return the size limit of the total sum of table files.
*/
long maxTableFilesSizeFIFO();
/** /**
* If true, compaction will verify checksum on every read that happens * If true, compaction will verify checksum on every read that happens
* as part of compaction * as part of compaction

View file

@ -437,6 +437,20 @@ public class Options extends RocksObject
return this; return this;
} }
@Override
public Options setMaxTableFilesSizeFIFO(
final long maxTableFilesSize) {
assert(maxTableFilesSize > 0); // unsigned native type
assert(isInitialized());
setMaxTableFilesSizeFIFO(nativeHandle_, maxTableFilesSize);
return this;
}
@Override
public long maxTableFilesSizeFIFO() {
return maxTableFilesSizeFIFO(nativeHandle_);
}
@Override @Override
public int tableCacheNumshardbits() { public int tableCacheNumshardbits() {
assert(isInitialized()); assert(isInitialized());
@ -1135,6 +1149,9 @@ public class Options extends RocksObject
private native void setMaxManifestFileSize( private native void setMaxManifestFileSize(
long handle, long maxManifestFileSize); long handle, long maxManifestFileSize);
private native long maxManifestFileSize(long handle); private native long maxManifestFileSize(long handle);
private native void setMaxTableFilesSizeFIFO(
long handle, long maxTableFilesSize);
private native long maxTableFilesSizeFIFO(long handle);
private native void setTableCacheNumshardbits( private native void setTableCacheNumshardbits(
long handle, int tableCacheNumshardbits); long handle, int tableCacheNumshardbits);
private native int tableCacheNumshardbits(long handle); private native int tableCacheNumshardbits(long handle);