-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94bb076
commit 9043721
Showing
5 changed files
with
75 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 65 additions & 44 deletions
109
java/src/main/java/org/rocksdb/TablePropertiesCollectorFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,65 @@ | ||
// Copyright (c) Meta Platforms, Inc. and affiliates. | ||
// | ||
// This source code is licensed under both the GPLv2 (found in the | ||
// COPYING file in the root directory) and Apache 2.0 License | ||
// (found in the LICENSE.Apache file in the root directory). | ||
|
||
package org.rocksdb; | ||
|
||
public abstract class TablePropertiesCollectorFactory extends RocksObject { | ||
private TablePropertiesCollectorFactory(final long nativeHandle) { | ||
super(nativeHandle); | ||
} | ||
|
||
public static TablePropertiesCollectorFactory NewCompactOnDeletionCollectorFactory( | ||
final long sliding_window_size, final long deletion_trigger, final double deletion_ratio) { | ||
long handle = | ||
newCompactOnDeletionCollectorFactory(sliding_window_size, deletion_trigger, deletion_ratio); | ||
return new TablePropertiesCollectorFactory(handle) { | ||
@Override | ||
protected void disposeInternal(long handle) { | ||
TablePropertiesCollectorFactory.deleteCompactOnDeletionCollectorFactory(handle); | ||
} | ||
}; | ||
} | ||
|
||
/** | ||
* Internal API. Do not use. | ||
* @param nativeHandle | ||
* @return | ||
*/ | ||
static TablePropertiesCollectorFactory newWrapper(final long nativeHandle) { | ||
return new TablePropertiesCollectorFactory(nativeHandle) { | ||
@Override | ||
protected void disposeInternal(long handle) { | ||
TablePropertiesCollectorFactory.deleteCompactOnDeletionCollectorFactory(handle); | ||
} | ||
}; | ||
} | ||
|
||
private static native long newCompactOnDeletionCollectorFactory( | ||
final long slidingWindowSize, final long deletionTrigger, final double deletionRatio); | ||
|
||
private static native void deleteCompactOnDeletionCollectorFactory(final long handle); | ||
} | ||
// Copyright (c) Meta Platforms, Inc. and affiliates. | ||
// | ||
// This source code is licensed under both the GPLv2 (found in the | ||
// COPYING file in the root directory) and Apache 2.0 License | ||
// (found in the LICENSE.Apache file in the root directory). | ||
|
||
package org.rocksdb; | ||
|
||
/** | ||
* Table Properties Collector Factory. | ||
*/ | ||
public abstract class TablePropertiesCollectorFactory extends RocksObject { | ||
private TablePropertiesCollectorFactory(final long nativeHandle) { | ||
super(nativeHandle); | ||
} | ||
|
||
/** | ||
* Creates a factory of a table property collector that marks a SST | ||
* file as need-compaction when it observes at least "D" deletion | ||
* entries in any "N" consecutive entries, or the ratio of tombstone | ||
* entries >= deletion_ratio. | ||
* | ||
* @param sliding_window_size "N".Note that this number will be | ||
* round up to the smallest multiple of 128 that is no less | ||
* than the specified size. | ||
* @param deletion_trigger "D". Note that even when "N" is changed, | ||
* the specified number for "D" will not be changed. | ||
* @param deletion_ratio, if <= 0 or > 1, disable triggering compaction | ||
* based on deletion ratio. Disabled by default. | ||
* | ||
* @return the new compact on deletion collector factory. | ||
*/ | ||
public static TablePropertiesCollectorFactory createNewCompactOnDeletionCollectorFactory( | ||
final long sliding_window_size, final long deletion_trigger, final double deletion_ratio) { | ||
final long handle = | ||
newCompactOnDeletionCollectorFactory(sliding_window_size, deletion_trigger, deletion_ratio); | ||
return new TablePropertiesCollectorFactory(handle) { | ||
@Override | ||
protected void disposeInternal(final long handle) { | ||
TablePropertiesCollectorFactory.deleteCompactOnDeletionCollectorFactory(handle); | ||
} | ||
}; | ||
} | ||
|
||
/** | ||
* Internal API. Do not use. | ||
* | ||
* @param nativeHandle the native handle to wrap. | ||
* | ||
* @return the new TablePropertiesCollectorFactory. | ||
*/ | ||
static TablePropertiesCollectorFactory newWrapper(final long nativeHandle) { | ||
return new TablePropertiesCollectorFactory(nativeHandle) { | ||
@Override | ||
protected void disposeInternal(long handle) { | ||
TablePropertiesCollectorFactory.deleteCompactOnDeletionCollectorFactory(handle); | ||
} | ||
}; | ||
} | ||
|
||
private static native long newCompactOnDeletionCollectorFactory( | ||
final long slidingWindowSize, final long deletionTrigger, final double deletionRatio); | ||
|
||
private static native void deleteCompactOnDeletionCollectorFactory(final long handle); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters