]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/SstFileWriter.java
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / SstFileWriter.java
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
5
6 package org.rocksdb;
7
8 public class SstFileWriter extends RocksObject {
9 static {
10 RocksDB.loadLibrary();
11 }
12
13 public SstFileWriter(final EnvOptions envOptions, final Options options,
14 final AbstractComparator<? extends AbstractSlice<?>> comparator) {
15 super(newSstFileWriter(
16 envOptions.nativeHandle_, options.nativeHandle_, comparator.getNativeHandle()));
17 }
18
19 public SstFileWriter(final EnvOptions envOptions, final Options options) {
20 super(newSstFileWriter(
21 envOptions.nativeHandle_, options.nativeHandle_));
22 }
23
24 public void open(final String filePath) throws RocksDBException {
25 open(nativeHandle_, filePath);
26 }
27
28 public void add(final Slice key, final Slice value) throws RocksDBException {
29 add(nativeHandle_, key.getNativeHandle(), value.getNativeHandle());
30 }
31
32 public void add(final DirectSlice key, final DirectSlice value) throws RocksDBException {
33 add(nativeHandle_, key.getNativeHandle(), value.getNativeHandle());
34 }
35
36 public void finish() throws RocksDBException {
37 finish(nativeHandle_);
38 }
39
40 private native static long newSstFileWriter(
41 final long envOptionsHandle, final long optionsHandle, final long userComparatorHandle);
42
43 private native static long newSstFileWriter(final long envOptionsHandle,
44 final long optionsHandle);
45
46 private native void open(final long handle, final String filePath) throws RocksDBException;
47
48 private native void add(final long handle, final long keyHandle, final long valueHandle)
49 throws RocksDBException;
50
51 private native void finish(final long handle) throws RocksDBException;
52
53 @Override protected final native void disposeInternal(final long handle);
54 }