]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/java/src/main/java/org/rocksdb/AbstractCompactionFilter.java
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / AbstractCompactionFilter.java
CommitLineData
7c673cae 1// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
11fdf7f2
TL
2// This source code is licensed under both the GPLv2 (found in the
3// COPYING file in the root directory) and Apache 2.0 License
4// (found in the LICENSE.Apache file in the root directory).
7c673cae
FG
5package org.rocksdb;
6
7/**
8 * A CompactionFilter allows an application to modify/delete a key-value at
9 * the time of compaction.
10 *
11 * At present we just permit an overriding Java class to wrap a C++
12 * implementation
13 */
14public abstract class AbstractCompactionFilter<T extends AbstractSlice<?>>
15 extends RocksObject {
16
11fdf7f2
TL
17 public static class Context {
18 private final boolean fullCompaction;
19 private final boolean manualCompaction;
20
21 public Context(final boolean fullCompaction, final boolean manualCompaction) {
22 this.fullCompaction = fullCompaction;
23 this.manualCompaction = manualCompaction;
24 }
25
26 /**
27 * Does this compaction run include all data files
28 *
29 * @return true if this is a full compaction run
30 */
31 public boolean isFullCompaction() {
32 return fullCompaction;
33 }
34
35 /**
36 * Is this compaction requested by the client,
37 * or is it occurring as an automatic compaction process
38 *
39 * @return true if the compaction was initiated by the client
40 */
41 public boolean isManualCompaction() {
42 return manualCompaction;
43 }
44 }
45
7c673cae
FG
46 protected AbstractCompactionFilter(final long nativeHandle) {
47 super(nativeHandle);
48 }
49
50 /**
51 * Deletes underlying C++ compaction pointer.
52 *
53 * Note that this function should be called only after all
54 * RocksDB instances referencing the compaction filter are closed.
55 * Otherwise an undefined behavior will occur.
56 */
57 @Override
58 protected final native void disposeInternal(final long handle);
59}