Skip to content

Commit

Permalink
Add missing JavaDoc, and fix JavaDoc warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
adamretter committed Dec 21, 2023
1 parent 4fd7db2 commit 10bb07a
Show file tree
Hide file tree
Showing 143 changed files with 3,477 additions and 346 deletions.
17 changes: 17 additions & 0 deletions java/src/main/java/org/rocksdb/AbstractCompactionFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@
* <p>
* At present, we just permit an overriding Java class to wrap a C++
* implementation
*
* @param <T> the concrete type of the {@link AbstractSlice} that the Compaction Filter uses.
*/
public abstract class AbstractCompactionFilter<T extends AbstractSlice<?>>
extends RocksObject {

/**
* Context of the Compaction Filter.
*/
public static class Context {
private final boolean fullCompaction;
private final boolean manualCompaction;

/**
* Context constructor.
*
* @param fullCompaction true to filter full compaction, false otherwise.
* @param manualCompaction true to filter manual compaction, false otherwise.
*/
public Context(final boolean fullCompaction, final boolean manualCompaction) {
this.fullCompaction = fullCompaction;
this.manualCompaction = manualCompaction;
Expand All @@ -43,6 +54,12 @@ public boolean isManualCompaction() {
}
}

/**
* Constructor to be called by subclasses to set the
* handle to the underlying C++ object.
*
* @param nativeHandle reference to the value of the C++ pointer pointing to the underlying native RocksDB C++ Compaction Filter.
*/
protected AbstractCompactionFilter(final long nativeHandle) {
super(nativeHandle);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
public abstract class AbstractCompactionFilterFactory<T extends AbstractCompactionFilter<?>>
extends RocksCallbackObject {

/**
* Constructs a new Compaction Filter Factory which has no underlying C++ object.
*/
public AbstractCompactionFilterFactory() {
super(0L);
}
Expand All @@ -26,8 +29,8 @@ protected long initializeNative(final long... nativeParameterHandles) {
/**
* Called from JNI, see compaction_filter_factory_jnicallback.cc
*
* @param fullCompaction {@link AbstractCompactionFilter.Context#fullCompaction}
* @param manualCompaction {@link AbstractCompactionFilter.Context#manualCompaction}
* @param fullCompaction {@link AbstractCompactionFilter.Context#isFullCompaction()}
* @param manualCompaction {@link AbstractCompactionFilter.Context#isManualCompaction()}
*
* @return native handle of the CompactionFilter
*/
Expand Down
14 changes: 12 additions & 2 deletions java/src/main/java/org/rocksdb/AbstractComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Comparators are used by RocksDB to determine
* the ordering of keys.
*
* <p>
* Implementations of Comparators in Java should extend this class.
*/
public abstract class AbstractComparator
Expand All @@ -20,6 +20,11 @@ public abstract class AbstractComparator
super();
}

/**
* Construct an AbstractComparator.
*
* @param comparatorOptions options for the comparator.
*/
protected AbstractComparator(final ComparatorOptions comparatorOptions) {
super(comparatorOptions.nativeHandle_);
}
Expand Down Expand Up @@ -59,7 +64,7 @@ ComparatorType getComparatorType() {
* Three-way key comparison. Implementations should provide a
* <a href="https://en.wikipedia.org/wiki/Total_order">total order</a>
* on keys that might be passed to it.
*
* <p>
* The implementation may modify the {@code ByteBuffer}s passed in, though
* it would be unconventional to modify the "limit" or any of the
* underlying bytes. As a callback, RocksJava will ensure that {@code a}
Expand Down Expand Up @@ -114,6 +119,11 @@ public void findShortSuccessor(final ByteBuffer key) {
// no-op
}

/**
* Returns true if we are using direct byte buffers.
*
* @return true if we are using direct byte buffers, false otherwise.
*/
public final boolean usingDirectBuffers() {
return usingDirectBuffers(nativeHandle_);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* it holds methods which are called
* from C++ to interact with a Comparator
* written in Java.
*
* <p>
* Placing these bridge methods in this
* class keeps the API of the
* {@link org.rocksdb.AbstractComparator} clean.
Expand Down
92 changes: 92 additions & 0 deletions java/src/main/java/org/rocksdb/AbstractEventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,120 @@
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public abstract class AbstractEventListener extends RocksCallbackObject implements EventListener {

/**
* Callback events that can be enabled.
*/
public enum EnabledEventCallback {

/**
* Flush completed.
*/
ON_FLUSH_COMPLETED((byte) 0x0),

/**
* Flush beginning.
*/
ON_FLUSH_BEGIN((byte) 0x1),

/**
* Table file was deleted.
*/
ON_TABLE_FILE_DELETED((byte) 0x2),

/**
* Compaction beginning.
*/
ON_COMPACTION_BEGIN((byte) 0x3),

/**
* Compaction completed.
*/
ON_COMPACTION_COMPLETED((byte) 0x4),

/**
* Table file created.
*/
ON_TABLE_FILE_CREATED((byte) 0x5),

/**
* Started creation of Table file.
*/
ON_TABLE_FILE_CREATION_STARTED((byte) 0x6),

/**
* Memtable has been sealed.
*/
ON_MEMTABLE_SEALED((byte) 0x7),

/**
* Started deletion of Column Family handle.
*/
ON_COLUMN_FAMILY_HANDLE_DELETION_STARTED((byte) 0x8),

/**
* External file ingested.
*/
ON_EXTERNAL_FILE_INGESTED((byte) 0x9),

/**
* Background error.
*/
ON_BACKGROUND_ERROR((byte) 0xA),

/**
* Stall conditions have been changed.
*/
ON_STALL_CONDITIONS_CHANGED((byte) 0xB),

/**
* File read has finished.
*/
ON_FILE_READ_FINISH((byte) 0xC),

/**
* File write has finished.
*/
ON_FILE_WRITE_FINISH((byte) 0xD),

/**
* File flush has finished.
*/
ON_FILE_FLUSH_FINISH((byte) 0xE),

/**
* File sync has finished.
*/
ON_FILE_SYNC_FINISH((byte) 0xF),

/**
* Range file read sync finished.
*/
ON_FILE_RANGE_SYNC_FINISH((byte) 0x10),

/**
* File truncation has finished.
*/
ON_FILE_TRUNCATE_FINISH((byte) 0x11),

/**
* Closing a file has finished.
*/
ON_FILE_CLOSE_FINISH((byte) 0x12),

/**
* Flag has been set to be notified on file IO.
*/
SHOULD_BE_NOTIFIED_ON_FILE_IO((byte) 0x13),

/**
* Error recovery beginning.
*/
ON_ERROR_RECOVERY_BEGIN((byte) 0x14),

/**
* Error recovery completed.
*/
ON_ERROR_RECOVERY_COMPLETED((byte) 0x15);

private final byte value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public abstract class AbstractImmutableNativeReference
*/
protected final AtomicBoolean owningHandle_;

/**
* Construct an AbstractImmutableNativeReference.
*
* @param owningHandle true if this Java object owns the underlying C++ object, false otherwise.
*/
protected AbstractImmutableNativeReference(final boolean owningHandle) {
this.owningHandle_ = new AtomicBoolean(owningHandle);
}
Expand Down
Loading

0 comments on commit 10bb07a

Please sign in to comment.