Interface WriteableTransaction
-
- All Superinterfaces:
ReadableTransaction
public interface WriteableTransaction extends ReadableTransaction
Represents a writeable transaction on a storage engine.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
WriteableTransaction.WriteTransactionOption
Options applicable to aWriteableTransaction
.-
Nested classes/interfaces inherited from interface org.opends.server.backends.pluggable.spi.ReadableTransaction
ReadableTransaction.ReadOption
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
createTreeIfAbsent(TreeName name)
Ensures that the tree identified by the provided name exists, creating it if it does not.default boolean
delete(TreeName treeName, ByteSequence key)
Deletes the record with the provided key, in the tree whose name is provided.default void
deleteTree(TreeName name)
Deletes the tree identified by the provided name if it exists.default void
put(TreeName treeName, ByteSequence key, ByteSequence value)
Adds a record with the provided key and value, replacing any existing record having the same key.default boolean
update(TreeName treeName, ByteSequence key, UpdateFunction f)
Atomically adds, deletes, or replaces a record with the provided key according to the new value computed by the update function.-
Methods inherited from interface org.opends.server.backends.pluggable.spi.ReadableTransaction
getRecordCount, openCursor, read
-
-
-
-
Method Detail
-
createTreeIfAbsent
default void createTreeIfAbsent(TreeName name)
Ensures that the tree identified by the provided name exists, creating it if it does not.- Parameters:
name
- the tree name- Throws:
ReadOnlyStorageException
- If the tree specified by the name does not exist and cannot be created as a result of the underlying storage being opened in read-only mode.- See Also:
Storage.open(AccessMode)
-
deleteTree
default void deleteTree(TreeName name)
Deletes the tree identified by the provided name if it exists. Otherwise, do nothing.- Parameters:
name
- the tree name- Throws:
ReadOnlyStorageException
- if the underlying storage has been opened in read-only mode.- See Also:
Storage.open(AccessMode)
-
put
default void put(TreeName treeName, ByteSequence key, ByteSequence value)
Adds a record with the provided key and value, replacing any existing record having the same key.- Parameters:
treeName
- the tree name. If the tree does not exist, it will be created.key
- the key of the new recordvalue
- the value of the new record- Throws:
ReadOnlyStorageException
- if the underlying storage has been opened in read-only mode.- See Also:
Storage.open(AccessMode)
-
update
default boolean update(TreeName treeName, ByteSequence key, UpdateFunction f)
Atomically adds, deletes, or replaces a record with the provided key according to the new value computed by the update function.- Parameters:
treeName
- the tree name. If the tree does not exist, it will be created.key
- the key of the new recordf
- the update function- Returns:
true
if an update was performed,false
otherwise- Throws:
ReadOnlyStorageException
- if the underlying storage has been opened in read-only mode.- See Also:
UpdateFunction.computeNewValue(ByteSequence)
,Storage.open(AccessMode)
-
delete
default boolean delete(TreeName treeName, ByteSequence key)
Deletes the record with the provided key, in the tree whose name is provided.- Parameters:
treeName
- the tree name. If the tree does not exist, it will be created.key
- the key of the record to delete- Returns:
true
if the record could be deleted,false
otherwise- Throws:
ReadOnlyStorageException
- if the underlying storage has been opened in read-only mode.- See Also:
Storage.open(AccessMode)
-
-