Interface Importer
-
- All Superinterfaces:
AutoCloseable,Closeable
@ThreadSafe public interface Importer extends Closeable
Allows to run an import. For performance reasons, imports are run without transactions.Since import is multi threaded, implementations must be thread-safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidaborted()Notifies this importer that the import failed or was cancelled, beforeclose()runs: what the trees hold is an incomplete import that is going to be run again.voidclearTree(TreeName treeName)Clear the tree whose name is provided.voidclose()SequentialCursor<ByteString,ByteString>openCursor(TreeName treeName)Opens a cursor on the tree whose name is provided.voidput(TreeName treeName, ByteSequence key, ByteSequence value)Creates a record with the provided key and value in the tree identified by the provided name.ByteStringread(TreeName treeName, ByteSequence key)Reads the record's value associated to the provided key, in the tree whose name is provided.
-
-
-
Method Detail
-
clearTree
void clearTree(TreeName treeName)
Clear the tree whose name is provided. Ensure that an empty tree with the given name exists. If the tree already exists, all the data it contains will be deleted. If not, an empty tree will be created.- Parameters:
treeName- name of the tree to clear
-
put
void put(TreeName treeName, ByteSequence key, ByteSequence value)
Creates a record with the provided key and value in the tree identified by the provided name. At the end of this method, the record is visible byread(TreeName, ByteSequence)andopenCursor(TreeName)methods of this instance. The record is guaranteed to be persisted only afterclose().- Parameters:
treeName- the tree namekey- the new record's keyvalue- the new record's value
-
read
ByteString read(TreeName treeName, ByteSequence 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
-
openCursor
SequentialCursor<ByteString,ByteString> openCursor(TreeName treeName)
Opens a cursor on the tree whose name is provided. Cursors are predictable only if there is no pendingput(TreeName, ByteSequence, ByteSequence)operations. Indeed, once opened, cursors might not reflect changes.- Parameters:
treeName- the tree name- Returns:
- a new cursor
-
aborted
default void aborted()
Notifies this importer that the import failed or was cancelled, beforeclose()runs: what the trees hold is an incomplete import that is going to be run again. Implementations doing work of their own inclose()on the assumption that the data is final - refreshing the optimizer statistics of a database, for instance - can skip it. The default implementation does nothing.
-
close
void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-