]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/java/src/main/java/org/rocksdb/OptimisticTransactionOptions.java
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / OptimisticTransactionOptions.java
CommitLineData
11fdf7f2
TL
1// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
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).
5
6package org.rocksdb;
7
8public class OptimisticTransactionOptions extends RocksObject
f67539c2 9 implements TransactionalOptions<OptimisticTransactionOptions> {
11fdf7f2
TL
10
11 public OptimisticTransactionOptions() {
12 super(newOptimisticTransactionOptions());
13 }
14
15 @Override
16 public boolean isSetSnapshot() {
17 assert(isOwningHandle());
18 return isSetSnapshot(nativeHandle_);
19 }
20
21 @Override
22 public OptimisticTransactionOptions setSetSnapshot(
23 final boolean setSnapshot) {
24 assert(isOwningHandle());
25 setSetSnapshot(nativeHandle_, setSnapshot);
26 return this;
27 }
28
29 /**
30 * Should be set if the DB has a non-default comparator.
31 * See comment in
32 * {@link WriteBatchWithIndex#WriteBatchWithIndex(AbstractComparator, int, boolean)}
33 * constructor.
34 *
35 * @param comparator The comparator to use for the transaction.
36 *
37 * @return this OptimisticTransactionOptions instance
38 */
39 public OptimisticTransactionOptions setComparator(
f67539c2 40 final AbstractComparator comparator) {
11fdf7f2
TL
41 assert(isOwningHandle());
42 setComparator(nativeHandle_, comparator.nativeHandle_);
43 return this;
44 }
45
46 private native static long newOptimisticTransactionOptions();
47 private native boolean isSetSnapshot(final long handle);
48 private native void setSetSnapshot(final long handle,
49 final boolean setSnapshot);
50 private native void setComparator(final long handle,
51 final long comparatorHandle);
52 @Override protected final native void disposeInternal(final long handle);
53}