]>
git.proxmox.com Git - ceph.git/blob - 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.
8 public class SstFileWriter
extends RocksObject
{
10 RocksDB
.loadLibrary();
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()));
19 public SstFileWriter(final EnvOptions envOptions
, final Options options
) {
20 super(newSstFileWriter(
21 envOptions
.nativeHandle_
, options
.nativeHandle_
));
24 public void open(final String filePath
) throws RocksDBException
{
25 open(nativeHandle_
, filePath
);
28 public void add(final Slice key
, final Slice value
) throws RocksDBException
{
29 add(nativeHandle_
, key
.getNativeHandle(), value
.getNativeHandle());
32 public void add(final DirectSlice key
, final DirectSlice value
) throws RocksDBException
{
33 add(nativeHandle_
, key
.getNativeHandle(), value
.getNativeHandle());
36 public void finish() throws RocksDBException
{
37 finish(nativeHandle_
);
40 private native static long newSstFileWriter(
41 final long envOptionsHandle
, final long optionsHandle
, final long userComparatorHandle
);
43 private native static long newSstFileWriter(final long envOptionsHandle
,
44 final long optionsHandle
);
46 private native void open(final long handle
, final String filePath
) throws RocksDBException
;
48 private native void add(final long handle
, final long keyHandle
, final long valueHandle
)
49 throws RocksDBException
;
51 private native void finish(final long handle
) throws RocksDBException
;
53 @Override protected final native void disposeInternal(final long handle
);