From 188bb2e7ad2c8eaf6e203fc53071001a9697f087 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Wed, 10 Feb 2016 14:21:23 +0000 Subject: [PATCH] Fix formatting identified by `arc lint` --- java/rocksjni/options.cc | 5 +- java/rocksjni/portal.h | 9 ++- java/rocksjni/rocksjni.cc | 6 +- .../java/org/rocksdb/AbstractWriteBatch.java | 15 +++-- .../main/java/org/rocksdb/BackupableDB.java | 10 +-- .../java/org/rocksdb/BackupableDBOptions.java | 66 ++++++++++--------- .../java/org/rocksdb/ColumnFamilyHandle.java | 6 +- .../java/org/rocksdb/ColumnFamilyOptions.java | 31 +++++---- java/src/main/java/org/rocksdb/DBOptions.java | 4 +- .../java/org/rocksdb/DirectComparator.java | 3 +- java/src/main/java/org/rocksdb/Options.java | 16 +++-- .../RemoveEmptyValueCompactionFilter.java | 3 +- .../java/org/rocksdb/RestoreBackupableDB.java | 3 +- .../main/java/org/rocksdb/RestoreOptions.java | 11 ++-- java/src/main/java/org/rocksdb/TtlDB.java | 7 +- .../src/main/java/org/rocksdb/WriteBatch.java | 6 +- .../java/org/rocksdb/WriteBatchWithIndex.java | 49 ++++++++------ 17 files changed, 147 insertions(+), 103 deletions(-) diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index 018d8bbe4..aac2564b2 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -1083,9 +1083,10 @@ jbyte Java_org_rocksdb_Options_compressionType( std::vector rocksdb_compression_vector_helper( JNIEnv* env, jbyteArray jcompressionLevels) { std::vector compressionLevels; - + jsize len = env->GetArrayLength(jcompressionLevels); - jbyte* jcompressionLevel = env->GetByteArrayElements(jcompressionLevels, NULL); + jbyte* jcompressionLevel = env->GetByteArrayElements(jcompressionLevels, + NULL); for(int i = 0; i < len; i++) { jbyte jcl; jcl = jcompressionLevel[i]; diff --git a/java/rocksjni/portal.h b/java/rocksjni/portal.h index f4ad29af5..cc47367a7 100644 --- a/java/rocksjni/portal.h +++ b/java/rocksjni/portal.h @@ -52,7 +52,8 @@ template class RocksDBNativeClass { }; // Native class template for sub-classes of RocksMutableObject -template class NativeRocksMutableObject : public RocksDBNativeClass { +template class NativeRocksMutableObject + : public RocksDBNativeClass { public: static jmethodID getSetNativeHandleMethod(JNIEnv* env) { @@ -63,8 +64,10 @@ template class NativeRocksMutableObject : public Rocks } // Pass the pointer to the java side. - static void setHandle(JNIEnv* env, jobject jobj, PTR ptr, jboolean java_owns_handle) { - env->CallVoidMethod(jobj, getSetNativeHandleMethod(env), reinterpret_cast(ptr), java_owns_handle); + static void setHandle(JNIEnv* env, jobject jobj, PTR ptr, + jboolean java_owns_handle) { + env->CallVoidMethod(jobj, getSetNativeHandleMethod(env), + reinterpret_cast(ptr), java_owns_handle); } }; diff --git a/java/rocksjni/rocksjni.cc b/java/rocksjni/rocksjni.cc index 7ef416618..c0c73ae2d 100644 --- a/java/rocksjni/rocksjni.cc +++ b/java/rocksjni/rocksjni.cc @@ -156,8 +156,8 @@ jlongArray Java_org_rocksdb_RocksDB_openROnly__JLjava_lang_String_2_3_3B_3J( jlongArray Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2_3_3B_3J( JNIEnv* env, jclass jcls, jlong jopt_handle, jstring jdb_path, jobjectArray jcolumn_names, jlongArray jcolumn_options) { - return rocksdb_open_helper(env, jopt_handle, jdb_path, jcolumn_names, jcolumn_options, - (rocksdb::Status(*) + return rocksdb_open_helper(env, jopt_handle, jdb_path, jcolumn_names, + jcolumn_options, (rocksdb::Status(*) (const rocksdb::DBOptions&, const std::string&, const std::vector&, std::vector*, rocksdb::DB**) @@ -458,7 +458,7 @@ jboolean Java_org_rocksdb_RocksDB_keyMayExist__JJ_3BIJLjava_lang_StringBuffer_2( rocksdb::RocksDBExceptionJni::ThrowNew(env, rocksdb::Status::InvalidArgument("Invalid ColumnFamilyHandle.")); return true; - } + } } ////////////////////////////////////////////////////////////////////////////// diff --git a/java/src/main/java/org/rocksdb/AbstractWriteBatch.java b/java/src/main/java/org/rocksdb/AbstractWriteBatch.java index 73d9876fb..c4eb01b1e 100644 --- a/java/src/main/java/org/rocksdb/AbstractWriteBatch.java +++ b/java/src/main/java/org/rocksdb/AbstractWriteBatch.java @@ -5,7 +5,8 @@ package org.rocksdb; -public abstract class AbstractWriteBatch extends RocksObject implements WriteBatchInterface { +public abstract class AbstractWriteBatch extends RocksObject + implements WriteBatchInterface { protected AbstractWriteBatch(final long nativeHandle) { super(nativeHandle); @@ -24,9 +25,11 @@ public abstract class AbstractWriteBatch extends RocksObject implements WriteBat } @Override - public void put(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value) { + public void put(ColumnFamilyHandle columnFamilyHandle, byte[] key, + byte[] value) { assert (isOwningHandle()); - put(nativeHandle_, key, key.length, value, value.length, columnFamilyHandle.nativeHandle_); + put(nativeHandle_, key, key.length, value, value.length, + columnFamilyHandle.nativeHandle_); } @Override @@ -36,9 +39,11 @@ public abstract class AbstractWriteBatch extends RocksObject implements WriteBat } @Override - public void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value) { + public void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key, + byte[] value) { assert (isOwningHandle()); - merge(nativeHandle_, key, key.length, value, value.length, columnFamilyHandle.nativeHandle_); + merge(nativeHandle_, key, key.length, value, value.length, + columnFamilyHandle.nativeHandle_); } @Override diff --git a/java/src/main/java/org/rocksdb/BackupableDB.java b/java/src/main/java/org/rocksdb/BackupableDB.java index 9bc29af81..cebd69f67 100644 --- a/java/src/main/java/org/rocksdb/BackupableDB.java +++ b/java/src/main/java/org/rocksdb/BackupableDB.java @@ -21,8 +21,8 @@ public class BackupableDB extends RocksDB { * * @param opt {@link org.rocksdb.Options} to set for the database. * @param bopt {@link org.rocksdb.BackupableDBOptions} to use. - * @param db_path Path to store data to. The path for storing the backup should be - * specified in the {@link org.rocksdb.BackupableDBOptions}. + * @param db_path Path to store data to. The path for storing the backup + * should be specified in the {@link org.rocksdb.BackupableDBOptions}. * * @return {@link BackupableDB} reference to the opened database. * @@ -34,7 +34,8 @@ public class BackupableDB extends RocksDB { throws RocksDBException { final RocksDB db = RocksDB.open(opt, db_path); - final BackupableDB bdb = new BackupableDB(open(db.nativeHandle_, bopt.nativeHandle_)); + final BackupableDB bdb = new BackupableDB(open(db.nativeHandle_, + bopt.nativeHandle_)); // Prevent the RocksDB object from attempting to delete // the underly C++ DB object. @@ -151,7 +152,8 @@ public class BackupableDB extends RocksDB { super.finalize(); } - protected native static long open(final long rocksDBHandle, final long backupDBOptionsHandle); + protected native static long open(final long rocksDBHandle, + final long backupDBOptionsHandle); protected native void createNewBackup(long handle, boolean flag) throws RocksDBException; protected native void purgeOldBackups(long handle, int numBackupsToKeep) diff --git a/java/src/main/java/org/rocksdb/BackupableDBOptions.java b/java/src/main/java/org/rocksdb/BackupableDBOptions.java index ea5e51a7a..89591de82 100644 --- a/java/src/main/java/org/rocksdb/BackupableDBOptions.java +++ b/java/src/main/java/org/rocksdb/BackupableDBOptions.java @@ -21,8 +21,8 @@ public class BackupableDBOptions extends RocksObject { /** *

BackupableDBOptions constructor.

* - * @param path Where to keep the backup files. Has to be different than db name. - * Best to set this to {@code db name_ + "/backups"} + * @param path Where to keep the backup files. Has to be different than db + * name. Best to set this to {@code db name_ + "/backups"} * @throws java.lang.IllegalArgumentException if illegal path is used. */ public BackupableDBOptions(final String path) { @@ -31,7 +31,8 @@ public class BackupableDBOptions extends RocksObject { private static String ensureWritableFile(final String path) { final File backupPath = path == null ? null : new File(path); - if (backupPath == null || !backupPath.isDirectory() || !backupPath.canWrite()) { + if (backupPath == null || !backupPath.isDirectory() || + !backupPath.canWrite()) { throw new IllegalArgumentException("Illegal path provided."); } else { return path; @@ -51,10 +52,11 @@ public class BackupableDBOptions extends RocksObject { /** *

Share table files between backups.

* - * @param shareTableFiles If {@code share_table_files == true}, backup will assume - * that table files with same name have the same contents. This enables incremental - * backups and avoids unnecessary data copies. If {@code share_table_files == false}, - * each backup will be on its own and will not share any data with other backups. + * @param shareTableFiles If {@code share_table_files == true}, backup will + * assume that table files with same name have the same contents. This + * enables incremental backups and avoids unnecessary data copies. If + * {@code share_table_files == false}, each backup will be on its own and + * will not share any data with other backups. * *

Default: true

* @@ -80,10 +82,10 @@ public class BackupableDBOptions extends RocksObject { /** *

Set synchronous backups.

* - * @param sync If {@code sync == true}, we can guarantee you'll get consistent backup - * even on a machine crash/reboot. Backup process is slower with sync enabled. - * If {@code sync == false}, we don't guarantee anything on machine reboot. - * However,chances are some of the backups are consistent. + * @param sync If {@code sync == true}, we can guarantee you'll get consistent + * backup even on a machine crash/reboot. Backup process is slower with sync + * enabled. If {@code sync == false}, we don't guarantee anything on machine + * reboot. However, chances are some of the backups are consistent. * *

Default: true

* @@ -108,7 +110,8 @@ public class BackupableDBOptions extends RocksObject { /** *

Set if old data will be destroyed.

* - * @param destroyOldData If true, it will delete whatever backups there are already. + * @param destroyOldData If true, it will delete whatever backups there are + * already. * *

Default: false

* @@ -133,9 +136,9 @@ public class BackupableDBOptions extends RocksObject { /** *

Set if log files shall be persisted.

* - * @param backupLogFiles If false, we won't backup log files. This option can be - * useful for backing up in-memory databases where log file are persisted,but table - * files are in memory. + * @param backupLogFiles If false, we won't backup log files. This option can + * be useful for backing up in-memory databases where log file are + * persisted, but table files are in memory. * *

Default: true

* @@ -160,8 +163,8 @@ public class BackupableDBOptions extends RocksObject { /** *

Set backup rate limit.

* - * @param backupRateLimit Max bytes that can be transferred in a second during backup. - * If 0 or negative, then go as fast as you can. + * @param backupRateLimit Max bytes that can be transferred in a second during + * backup. If 0 or negative, then go as fast as you can. * *

Default: 0

* @@ -175,10 +178,11 @@ public class BackupableDBOptions extends RocksObject { } /** - *

Return backup rate limit which described the max bytes that can be transferred in a - * second during backup.

+ *

Return backup rate limit which described the max bytes that can be + * transferred in a second during backup.

* - * @return numerical value describing the backup transfer limit in bytes per second. + * @return numerical value describing the backup transfer limit in bytes per + * second. */ public long backupRateLimit() { assert(isOwningHandle()); @@ -188,8 +192,8 @@ public class BackupableDBOptions extends RocksObject { /** *

Set restore rate limit.

* - * @param restoreRateLimit Max bytes that can be transferred in a second during restore. - * If 0 or negative, then go as fast as you can. + * @param restoreRateLimit Max bytes that can be transferred in a second + * during restore. If 0 or negative, then go as fast as you can. * *

Default: 0

* @@ -203,10 +207,11 @@ public class BackupableDBOptions extends RocksObject { } /** - *

Return restore rate limit which described the max bytes that can be transferred in a - * second during restore.

+ *

Return restore rate limit which described the max bytes that can be + * transferred in a second during restore.

* - * @return numerical value describing the restore transfer limit in bytes per second. + * @return numerical value describing the restore transfer limit in bytes per + * second. */ public long restoreRateLimit() { assert(isOwningHandle()); @@ -214,12 +219,13 @@ public class BackupableDBOptions extends RocksObject { } /** - *

Only used if share_table_files is set to true. If true, will consider that - * backups can come from different databases, hence a sst is not uniquely - * identified by its name, but by the triple (file name, crc32, file length)

+ *

Only used if share_table_files is set to true. If true, will consider + * that backups can come from different databases, hence a sst is not uniquely + * identified by its name, but by the triple (file name, crc32, file length) + *

* - * @param shareFilesWithChecksum boolean value indicating if SST files are stored - * using the triple (file name, crc32, file length) and not its name. + * @param shareFilesWithChecksum boolean value indicating if SST files are + * stored using the triple (file name, crc32, file length) and not its name. * *

Note: this is an experimental option, and you'll need to set it manually * turn it on only if you know what you're doing*

diff --git a/java/src/main/java/org/rocksdb/ColumnFamilyHandle.java b/java/src/main/java/org/rocksdb/ColumnFamilyHandle.java index b9f6bd97e..6aa22d3fe 100644 --- a/java/src/main/java/org/rocksdb/ColumnFamilyHandle.java +++ b/java/src/main/java/org/rocksdb/ColumnFamilyHandle.java @@ -25,9 +25,9 @@ public class ColumnFamilyHandle extends RocksObject { *

Deletes underlying C++ iterator pointer.

* *

Note: the underlying handle can only be safely deleted if the RocksDB - * instance related to a certain ColumnFamilyHandle is still valid and initialized. - * Therefore {@code disposeInternal()} checks if the RocksDB is initialized - * before freeing the native handle.

+ * instance related to a certain ColumnFamilyHandle is still valid and + * initialized. Therefore {@code disposeInternal()} checks if the RocksDB is + * initialized before freeing the native handle.

*/ @Override protected void disposeInternal() { diff --git a/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java b/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java index 500935cf4..6a7b580bf 100644 --- a/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java +++ b/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java @@ -13,8 +13,8 @@ import java.util.Properties; * ColumnFamilyOptions to control the behavior of a database. It will be used * during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()). * - * If {@link #dispose()} function is not called, then it will be GC'd automatically - * and native resources will be released as part of the process. + * If {@link #dispose()} function is not called, then it will be GC'd + * automatically and native resources will be released as part of the process. */ public class ColumnFamilyOptions extends RocksObject implements ColumnFamilyOptionsInterface { @@ -112,7 +112,8 @@ public class ColumnFamilyOptions extends RocksObject } @Override - public ColumnFamilyOptions setComparator(final BuiltinComparator builtinComparator) { + public ColumnFamilyOptions setComparator( + final BuiltinComparator builtinComparator) { assert(isOwningHandle()); setComparatorHandle(nativeHandle_, builtinComparator.ordinal()); return this; @@ -139,13 +140,15 @@ public class ColumnFamilyOptions extends RocksObject } @Override - public ColumnFamilyOptions setMergeOperator(final MergeOperator mergeOperator) { + public ColumnFamilyOptions setMergeOperator( + final MergeOperator mergeOperator) { setMergeOperator(nativeHandle_, mergeOperator.newMergeOperatorHandle()); return this; } public ColumnFamilyOptions setCompactionFilter( - final AbstractCompactionFilter> compactionFilter) { + final AbstractCompactionFilter> + compactionFilter) { setCompactionFilterHandle(nativeHandle_, compactionFilter.nativeHandle_); compactionFilter_ = compactionFilter; return this; @@ -205,7 +208,8 @@ public class ColumnFamilyOptions extends RocksObject } @Override - public ColumnFamilyOptions setCompressionType(final CompressionType compressionType) { + public ColumnFamilyOptions setCompressionType( + final CompressionType compressionType) { setCompressionType(nativeHandle_, compressionType.getValue()); return this; } @@ -522,7 +526,8 @@ public class ColumnFamilyOptions extends RocksObject @Override public ColumnFamilyOptions setMaxSequentialSkipInIterations( final long maxSequentialSkipInIterations) { - setMaxSequentialSkipInIterations(nativeHandle_, maxSequentialSkipInIterations); + setMaxSequentialSkipInIterations(nativeHandle_, + maxSequentialSkipInIterations); return this; } @@ -677,12 +682,12 @@ public class ColumnFamilyOptions extends RocksObject private native void optimizeUniversalStyleCompaction(long handle, long memtableMemoryBudget); private native void setComparatorHandle(long handle, int builtinComparator); - private native void setComparatorHandle(long optHandle, long comparatorHandle); - private native void setMergeOperatorName( - long handle, String name); - private native void setMergeOperator( - long handle, long mergeOperatorHandle); - private native void setCompactionFilterHandle(long handle, long compactionFilterHandle); + private native void setComparatorHandle(long optHandle, + long comparatorHandle); + private native void setMergeOperatorName(long handle, String name); + private native void setMergeOperator(long handle, long mergeOperatorHandle); + private native void setCompactionFilterHandle(long handle, + long compactionFilterHandle); private native void setWriteBufferSize(long handle, long writeBufferSize) throws IllegalArgumentException; private native long writeBufferSize(long handle); diff --git a/java/src/main/java/org/rocksdb/DBOptions.java b/java/src/main/java/org/rocksdb/DBOptions.java index a9ed2527a..878dd4d70 100644 --- a/java/src/main/java/org/rocksdb/DBOptions.java +++ b/java/src/main/java/org/rocksdb/DBOptions.java @@ -11,8 +11,8 @@ import java.util.Properties; * DBOptions to control the behavior of a database. It will be used * during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()). * - * If {@link #dispose()} function is not called, then it will be GC'd automatically - * and native resources will be released as part of the process. + * If {@link #dispose()} function is not called, then it will be GC'd + * automatically and native resources will be released as part of the process. */ public class DBOptions extends RocksObject implements DBOptionsInterface { static { diff --git a/java/src/main/java/org/rocksdb/DirectComparator.java b/java/src/main/java/org/rocksdb/DirectComparator.java index ba3fce798..d28804756 100644 --- a/java/src/main/java/org/rocksdb/DirectComparator.java +++ b/java/src/main/java/org/rocksdb/DirectComparator.java @@ -28,5 +28,6 @@ public abstract class DirectComparator extends AbstractComparator { return nativeHandle_; } - private native long createNewDirectComparator0(final long comparatorOptionsHandle); + private native long createNewDirectComparator0( + final long comparatorOptionsHandle); } diff --git a/java/src/main/java/org/rocksdb/Options.java b/java/src/main/java/org/rocksdb/Options.java index 1bc45ed1a..56fd5ab18 100644 --- a/java/src/main/java/org/rocksdb/Options.java +++ b/java/src/main/java/org/rocksdb/Options.java @@ -12,8 +12,8 @@ import java.util.List; * Options to control the behavior of a database. It will be used * during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()). * - * If {@link #dispose()} function is not called, then it will be GC'd automatically - * and native resources will be released as part of the process. + * If {@link #dispose()} function is not called, then it will be GC'd + * automaticallyand native resources will be released as part of the process. */ public class Options extends RocksObject implements DBOptionsInterface, ColumnFamilyOptionsInterface { @@ -41,7 +41,8 @@ public class Options extends RocksObject */ public Options(final DBOptions dbOptions, final ColumnFamilyOptions columnFamilyOptions) { - super(newOptions(dbOptions.nativeHandle_, columnFamilyOptions.nativeHandle_)); + super(newOptions(dbOptions.nativeHandle_, + columnFamilyOptions.nativeHandle_)); env_ = Env.getDefault(); } @@ -678,7 +679,8 @@ public class Options extends RocksObject } @Override - public Options setCompressionPerLevel(final List compressionLevels) { + public Options setCompressionPerLevel( + final List compressionLevels) { final byte[] byteCompressionTypes = new byte[ compressionLevels.size()]; for (int i = 0; i < compressionLevels.size(); i++) { @@ -973,7 +975,8 @@ public class Options extends RocksObject @Override public Options setMaxSequentialSkipInIterations( final long maxSequentialSkipInIterations) { - setMaxSequentialSkipInIterations(nativeHandle_, maxSequentialSkipInIterations); + setMaxSequentialSkipInIterations(nativeHandle_, + maxSequentialSkipInIterations); return this; } @@ -1189,7 +1192,8 @@ public class Options extends RocksObject private native void optimizeUniversalStyleCompaction(long handle, long memtableMemoryBudget); private native void setComparatorHandle(long handle, int builtinComparator); - private native void setComparatorHandle(long optHandle, long comparatorHandle); + private native void setComparatorHandle(long optHandle, + long comparatorHandle); private native void setMergeOperatorName( long handle, String name); private native void setMergeOperator( diff --git a/java/src/main/java/org/rocksdb/RemoveEmptyValueCompactionFilter.java b/java/src/main/java/org/rocksdb/RemoveEmptyValueCompactionFilter.java index 5bc5dbe72..1beb45c46 100644 --- a/java/src/main/java/org/rocksdb/RemoveEmptyValueCompactionFilter.java +++ b/java/src/main/java/org/rocksdb/RemoveEmptyValueCompactionFilter.java @@ -8,7 +8,8 @@ package org.rocksdb; /** * Just a Java wrapper around EmptyValueCompactionFilter implemented in C++ */ -public class RemoveEmptyValueCompactionFilter extends AbstractCompactionFilter { +public class RemoveEmptyValueCompactionFilter + extends AbstractCompactionFilter { public RemoveEmptyValueCompactionFilter() { super(createNewRemoveEmptyValueCompactionFilter0()); } diff --git a/java/src/main/java/org/rocksdb/RestoreBackupableDB.java b/java/src/main/java/org/rocksdb/RestoreBackupableDB.java index 86610cc31..f303b1507 100644 --- a/java/src/main/java/org/rocksdb/RestoreBackupableDB.java +++ b/java/src/main/java/org/rocksdb/RestoreBackupableDB.java @@ -153,5 +153,6 @@ public class RestoreBackupableDB extends RocksObject { private native int[] getCorruptedBackups(long handle); private native void garbageCollect(long handle) throws RocksDBException; - @Override protected final native void disposeInternal(final long nativeHandle); + @Override protected final native void disposeInternal( + final long nativeHandle); } diff --git a/java/src/main/java/org/rocksdb/RestoreOptions.java b/java/src/main/java/org/rocksdb/RestoreOptions.java index 9eecbc8e1..54b0eff28 100644 --- a/java/src/main/java/org/rocksdb/RestoreOptions.java +++ b/java/src/main/java/org/rocksdb/RestoreOptions.java @@ -16,11 +16,12 @@ public class RestoreOptions extends RocksObject { /** * Constructor * - * @param keepLogFiles If true, restore won't overwrite the existing log files in wal_dir. It - * will also move all log files from archive directory to wal_dir. Use this - * option in combination with BackupableDBOptions::backup_log_files = false - * for persisting in-memory databases. - * Default: false + * @param keepLogFiles If true, restore won't overwrite the existing log files + * in wal_dir. It will also move all log files from archive directory to + * wal_dir. Use this option in combination with + * BackupableDBOptions::backup_log_files = false for persisting in-memory + * databases. + * Default: false */ public RestoreOptions(final boolean keepLogFiles) { super(newRestoreOptions(keepLogFiles)); diff --git a/java/src/main/java/org/rocksdb/TtlDB.java b/java/src/main/java/org/rocksdb/TtlDB.java index 8589478fe..72704893c 100644 --- a/java/src/main/java/org/rocksdb/TtlDB.java +++ b/java/src/main/java/org/rocksdb/TtlDB.java @@ -112,14 +112,15 @@ public class TtlDB extends RocksDB { final List ttlValues, final boolean readOnly) throws RocksDBException { if (columnFamilyDescriptors.size() != ttlValues.size()) { - throw new IllegalArgumentException("There must be a ttl value per column" + - "family handle."); + throw new IllegalArgumentException("There must be a ttl value per column" + + "family handle."); } final byte[][] cfNames = new byte[columnFamilyDescriptors.size()][]; final long[] cfOptionHandles = new long[columnFamilyDescriptors.size()]; for (int i = 0; i < columnFamilyDescriptors.size(); i++) { - final ColumnFamilyDescriptor cfDescriptor = columnFamilyDescriptors.get(i); + final ColumnFamilyDescriptor cfDescriptor = + columnFamilyDescriptors.get(i); cfNames[i] = cfDescriptor.columnFamilyName(); cfOptionHandles[i] = cfDescriptor.columnFamilyOptions().nativeHandle_; } diff --git a/java/src/main/java/org/rocksdb/WriteBatch.java b/java/src/main/java/org/rocksdb/WriteBatch.java index de614b1b5..d9e1098cb 100644 --- a/java/src/main/java/org/rocksdb/WriteBatch.java +++ b/java/src/main/java/org/rocksdb/WriteBatch.java @@ -84,13 +84,15 @@ public class WriteBatch extends AbstractWriteBatch { @Override final native void clear0(final long handle); private native static long newWriteBatch(final int reserved_bytes); - private native void iterate(final long handle, final long handlerHandle) throws RocksDBException; + private native void iterate(final long handle, final long handlerHandle) + throws RocksDBException; /** * Handler callback for iterating over the contents of a batch. */ - public static abstract class Handler extends AbstractImmutableNativeReference { + public static abstract class Handler + extends AbstractImmutableNativeReference { private final long nativeHandle_; public Handler() { super(true); diff --git a/java/src/main/java/org/rocksdb/WriteBatchWithIndex.java b/java/src/main/java/org/rocksdb/WriteBatchWithIndex.java index 469945f06..254bf7e6a 100644 --- a/java/src/main/java/org/rocksdb/WriteBatchWithIndex.java +++ b/java/src/main/java/org/rocksdb/WriteBatchWithIndex.java @@ -12,10 +12,10 @@ package org.rocksdb; * Calling put, merge, remove or putLogData calls the same function * as with {@link org.rocksdb.WriteBatch} whilst also building an index. * - * A user can call {@link org.rocksdb.WriteBatchWithIndex#newIterator() }to create an iterator - * over the write batch or - * {@link org.rocksdb.WriteBatchWithIndex#newIteratorWithBase(org.rocksdb.RocksIterator)} to - * get an iterator for the database with Read-Your-Own-Writes like capability + * A user can call {@link org.rocksdb.WriteBatchWithIndex#newIterator()} to + * create an iterator over the write batch or + * {@link org.rocksdb.WriteBatchWithIndex#newIteratorWithBase(org.rocksdb.RocksIterator)} + * to get an iterator for the database with Read-Your-Own-Writes like capability */ public class WriteBatchWithIndex extends AbstractWriteBatch { /** @@ -56,9 +56,12 @@ public class WriteBatchWithIndex extends AbstractWriteBatch { * inserting a duplicate key, in this way an iterator will never * show two entries with the same key. */ - public WriteBatchWithIndex(final AbstractComparator> - fallbackIndexComparator, final int reservedBytes, final boolean overwriteKey) { - super(newWriteBatchWithIndex(fallbackIndexComparator.getNativeHandle(), reservedBytes, overwriteKey)); + public WriteBatchWithIndex( + final AbstractComparator> + fallbackIndexComparator, final int reservedBytes, + final boolean overwriteKey) { + super(newWriteBatchWithIndex(fallbackIndexComparator.getNativeHandle(), + reservedBytes, overwriteKey)); } /** @@ -70,9 +73,11 @@ public class WriteBatchWithIndex extends AbstractWriteBatch { * time. * * @param columnFamilyHandle The column family to iterate over - * @return An iterator for the Write Batch contents, restricted to the column family + * @return An iterator for the Write Batch contents, restricted to the column + * family */ - public WBWIRocksIterator newIterator(final ColumnFamilyHandle columnFamilyHandle) { + public WBWIRocksIterator newIterator( + final ColumnFamilyHandle columnFamilyHandle) { return new WBWIRocksIterator(this, iterator1(nativeHandle_, columnFamilyHandle.nativeHandle_)); } @@ -97,11 +102,13 @@ public class WriteBatchWithIndex extends AbstractWriteBatch { * as a delta and baseIterator as a base * * @param columnFamilyHandle The column family to iterate over - * @param baseIterator The base iterator, e.g. {@link org.rocksdb.RocksDB#newIterator()} - * @return An iterator which shows a view comprised of both the database point-in-time - * from baseIterator and modifications made in this write batch. + * @param baseIterator The base iterator, + * e.g. {@link org.rocksdb.RocksDB#newIterator()} + * @return An iterator which shows a view comprised of both the database + * point-in-time from baseIterator and modifications made in this write batch. */ - public RocksIterator newIteratorWithBase(final ColumnFamilyHandle columnFamilyHandle, + public RocksIterator newIteratorWithBase( + final ColumnFamilyHandle columnFamilyHandle, final RocksIterator baseIterator) { RocksIterator iterator = new RocksIterator( baseIterator.parent_, @@ -116,14 +123,17 @@ public class WriteBatchWithIndex extends AbstractWriteBatch { /** * Provides Read-Your-Own-Writes like functionality by * creating a new Iterator that will use {@link org.rocksdb.WBWIRocksIterator} - * as a delta and baseIterator as a base. Operates on the default column family. + * as a delta and baseIterator as a base. Operates on the default column + * family. * - * @param baseIterator The base iterator, e.g. {@link org.rocksdb.RocksDB#newIterator()} - * @return An iterator which shows a view comprised of both the database point-in-time - * from baseIterator and modifications made in this write batch. + * @param baseIterator The base iterator, + * e.g. {@link org.rocksdb.RocksDB#newIterator()} + * @return An iterator which shows a view comprised of both the database + * point-in-timefrom baseIterator and modifications made in this write batch. */ public RocksIterator newIteratorWithBase(final RocksIterator baseIterator) { - return newIteratorWithBase(baseIterator.parent_.getDefaultColumnFamily(), baseIterator); + return newIteratorWithBase(baseIterator.parent_.getDefaultColumnFamily(), + baseIterator); } @Override protected final native void disposeInternal(final long handle); @@ -153,5 +163,6 @@ public class WriteBatchWithIndex extends AbstractWriteBatch { final boolean overwriteKey); private native long iterator0(final long handle); private native long iterator1(final long handle, final long cfHandle); - private native long iteratorWithBase(final long handle, final long baseIteratorHandle, final long cfHandle); + private native long iteratorWithBase(final long handle, + final long baseIteratorHandle, final long cfHandle); }