Package alluxio.master.metastore.rocks
Class RocksUtils
- java.lang.Object
-
- alluxio.master.metastore.rocks.RocksUtils
-
public final class RocksUtils extends java.lang.Object
Convenience methods for working with RocksDB.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RocksUtils.RocksIteratorParser<T>
Used to parse currentRocksIterator
element.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> CloseableIterator<T>
createCloseableIterator(org.rocksdb.RocksIterator rocksIterator, RocksUtils.RocksIteratorParser<T> parser)
Used to wrap anCloseableIterator
overRocksIterator
.static long
readLong(byte[] bytes, int start)
static byte[]
toByteArray(long long1, long long2)
static byte[]
toByteArray(long n, java.lang.String str)
-
-
-
Method Detail
-
toByteArray
public static byte[] toByteArray(long long1, long long2)
- Parameters:
long1
- a long valuelong2
- a long value- Returns:
- a byte array formed by writing the two long values as bytes
-
toByteArray
public static byte[] toByteArray(long n, java.lang.String str)
- Parameters:
n
- a long valuestr
- a string value- Returns:
- a byte array formed by writing the bytes of n followed by the bytes of str
-
readLong
public static long readLong(byte[] bytes, int start)
- Parameters:
bytes
- an array of bytesstart
- the place in the array to read the long from- Returns:
- the long
-
createCloseableIterator
public static <T> CloseableIterator<T> createCloseableIterator(org.rocksdb.RocksIterator rocksIterator, RocksUtils.RocksIteratorParser<T> parser)
Used to wrap anCloseableIterator
overRocksIterator
. It seeks given iterator to first entry before returning the iterator.- Type Parameters:
T
- iterator value type- Parameters:
rocksIterator
- the rocks iteratorparser
- parser to produce iterated values from rocks key-value- Returns:
- wrapped iterator
-
-