Package org.rocksdb
Class SstFileWriter
- java.lang.Object
-
- org.rocksdb.AbstractNativeReference
-
- org.rocksdb.AbstractImmutableNativeReference
-
- org.rocksdb.RocksObject
-
- org.rocksdb.SstFileWriter
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class SstFileWriter extends RocksObject
SstFileWriter is used to create sst files that can be added to the database later. All keys in files generated by SstFileWriter will have sequence number = 0.
-
-
Field Summary
-
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_
-
Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_
-
-
Constructor Summary
Constructors Constructor Description SstFileWriter(EnvOptions envOptions, Options options)SstFileWriter Constructor.SstFileWriter(EnvOptions envOptions, Options options, AbstractComparator comparator)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(DirectSlice key, DirectSlice value)Deprecated.voidadd(Slice key, Slice value)Deprecated.voiddelete(byte[] key)Add a deletion key to currently opened file.voiddelete(DirectSlice key)Add a deletion key to currently opened file.voiddelete(Slice key)Add a deletion key to currently opened file.protected voiddisposeInternal(long handle)longfileSize()Return the current file size.voidfinish()Finish the process and close the sst file.voidmerge(byte[] key, byte[] value)Add a Merge key with value to currently opened file.voidmerge(DirectSlice key, DirectSlice value)Add a Merge key with value to currently opened file.voidmerge(Slice key, Slice value)Add a Merge key with value to currently opened file.voidopen(java.lang.String filePath)Prepare SstFileWriter to write to a file.voidput(byte[] key, byte[] value)Add a Put key with value to currently opened file.voidput(java.nio.ByteBuffer key, java.nio.ByteBuffer value)Add a Put key with value to currently opened file.voidput(DirectSlice key, DirectSlice value)Add a Put key with value to currently opened file.voidput(Slice key, Slice value)Add a Put key with value to currently opened file.-
Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandle
-
Methods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Methods inherited from class org.rocksdb.AbstractNativeReference
dispose, finalize
-
-
-
-
Constructor Detail
-
SstFileWriter
@Deprecated public SstFileWriter(EnvOptions envOptions, Options options, AbstractComparator comparator)
Deprecated.UseSstFileWriter(EnvOptions, Options). Passing an explicit comparator is deprecated in lieu of passing the comparator as part of options. Use the other constructor instead.SstFileWriter Constructor.- Parameters:
envOptions-EnvOptionsinstance.options-Optionsinstance.comparator- the comparator to specify the ordering of keys.
-
SstFileWriter
public SstFileWriter(EnvOptions envOptions, Options options)
SstFileWriter Constructor.- Parameters:
envOptions-EnvOptionsinstance.options-Optionsinstance.
-
-
Method Detail
-
open
public void open(java.lang.String filePath) throws RocksDBExceptionPrepare SstFileWriter to write to a file.- Parameters:
filePath- the location of file- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
add
@Deprecated public void add(Slice key, Slice value) throws RocksDBException
Deprecated.Add a Put key with value to currently opened file.- Parameters:
key- the specified key to be inserted.value- the value associated with the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
add
@Deprecated public void add(DirectSlice key, DirectSlice value) throws RocksDBException
Deprecated.Add a Put key with value to currently opened file.- Parameters:
key- the specified key to be inserted.value- the value associated with the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
put
public void put(Slice key, Slice value) throws RocksDBException
Add a Put key with value to currently opened file.- Parameters:
key- the specified key to be inserted.value- the value associated with the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
put
public void put(DirectSlice key, DirectSlice value) throws RocksDBException
Add a Put key with value to currently opened file.- Parameters:
key- the specified key to be inserted.value- the value associated with the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
put
public void put(java.nio.ByteBuffer key, java.nio.ByteBuffer value) throws RocksDBExceptionAdd a Put key with value to currently opened file.- Parameters:
key- the specified key to be inserted.value- the value associated with the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
put
public void put(byte[] key, byte[] value) throws RocksDBExceptionAdd a Put key with value to currently opened file.- Parameters:
key- the specified key to be inserted.value- the value associated with the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
merge
public void merge(Slice key, Slice value) throws RocksDBException
Add a Merge key with value to currently opened file.- Parameters:
key- the specified key to be merged.value- the value to be merged with the current value for the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
merge
public void merge(byte[] key, byte[] value) throws RocksDBExceptionAdd a Merge key with value to currently opened file.- Parameters:
key- the specified key to be merged.value- the value to be merged with the current value for the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
merge
public void merge(DirectSlice key, DirectSlice value) throws RocksDBException
Add a Merge key with value to currently opened file.- Parameters:
key- the specified key to be merged.value- the value to be merged with the current value for the specified key.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
delete
public void delete(Slice key) throws RocksDBException
Add a deletion key to currently opened file.- Parameters:
key- the specified key to be deleted.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
delete
public void delete(DirectSlice key) throws RocksDBException
Add a deletion key to currently opened file.- Parameters:
key- the specified key to be deleted.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
delete
public void delete(byte[] key) throws RocksDBExceptionAdd a deletion key to currently opened file.- Parameters:
key- the specified key to be deleted.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
finish
public void finish() throws RocksDBExceptionFinish the process and close the sst file.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
fileSize
public long fileSize() throws RocksDBExceptionReturn the current file size.- Throws:
RocksDBException- thrown if error happens in underlying native library.
-
disposeInternal
protected final void disposeInternal(long handle)
- Specified by:
disposeInternalin classRocksObject
-
-