Interface ReadableTransaction
-
- All Known Subinterfaces:
WriteableTransaction
public interface ReadableTransactionRepresents a readable transaction on a storage engine.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classReadableTransaction.ReadOptionOptions applicable toopenCursor(TreeName, ReadOption...).
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default longgetRecordCount(TreeName treeName)Returns the number of key/value pairs in the provided tree.default Cursor<ByteString,ByteString>openCursor(TreeName treeName, ReadableTransaction.ReadOption... options)Opens a non-positioned cursor on the tree whose name is provided.default ByteStringread(TreeName treeName, ByteString key)Reads the record's value associated to the provided key, in the tree whose name is provided.
-
-
-
Method Detail
-
read
default ByteString read(TreeName treeName, ByteString key)
Reads the record's value associated to the provided key, in the tree whose name is provided.- Parameters:
treeName- the tree namekey- the record's key- Returns:
- the record's value, or
nullif none exists or if the tree does not exist.
-
openCursor
default Cursor<ByteString,ByteString> openCursor(TreeName treeName, ReadableTransaction.ReadOption... options)
Opens a non-positioned cursor on the tree whose name is provided. The cursor will then have to be positioned (e.g: by invokingSequentialCursor.next()) to bedefined.- Parameters:
treeName- the tree nameoptions- the options to apply to the opened cursor.- Returns:
- a new non-positioned cursor or an empty cursor if the tree does not exist.
-
getRecordCount
default long getRecordCount(TreeName treeName)
Returns the number of key/value pairs in the provided tree.- Parameters:
treeName- the tree name- Returns:
- the number of key/value pairs in the provided tree or
0if the tree does not exist.
-
-