Interface Storage
- All Superinterfaces:
AutoCloseable, Backupable, Closeable
- All Known Implementing Classes:
JEStorage
This interface abstracts the underlying storage engine, isolating the pluggable backend generic code from a
particular storage engine implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordStorage operation configuration.static enumOptions applicable to transactions and operations. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidEnsures the provided Storage instance is available.default voidPerforms a self-check of the storage engine and update the storage status accordingly.voidclose()static Storage.Configconfig()Returns storage configuration.static Storage.ConfigGets the configuration with specificHinthints.static Storage.Configconfig(Set<Storage.Hint> hints) Gets the configuration with specificHinthints.Returns the current status of the storage.Lists the trees that exist in this storage.voidopen(AccessMode accessMode) Opens the storage engine to allow executing operations on it.default <T> Tread(ReadOperation<T> readOperation) Executes a read operation.<T> Tread(Storage.Config config, ReadOperation<T> readOperation) Executes a read operation.voidRemove all files for a backend of this storage.Starts the import operation.voidwrite(Storage.Config config, WriteOperation writeOperation) Executes a write operation.default voidwrite(WriteOperation writeOperation) Executes a write operation.Methods inherited from interface Backupable
afterBackup, afterRestore, beforeBackup, beforeRestore, getBackendFiles, getBackendID, getDirectory
-
Field Details
-
DEFAULT_HINTS
NoStorage.Hint, use default.
-
-
Method Details
-
config
Gets the configuration with specificHinthints.- Parameters:
transactionId- the transaction ID- Returns:
- storage configuration
-
config
Gets the configuration with specificHinthints.- Parameters:
hints- the hints to use- Returns:
- storage configuration
-
config
-
startImport
Starts the import operation.- Returns:
- a new Importer object which must be closed to release all resources
- Throws:
ConfigException- if there is a problem with the configurationStorageException- if a problem occurs with the underlying storage engine- See Also:
-
open
Opens the storage engine to allow executing operations on it.- Parameters:
accessMode- Specify the access mode to this storage.- Throws:
NullPointerException- if accessMode is null.Exception- if a problem occurs with the underlying storage engine- See Also:
-
read
Executes a read operation. In case of a read operation rollback, implementations must ensure the read operation is retried until it succeeds.- Type Parameters:
T- type of the value returned- Parameters:
readOperation- the read operation to execute- Returns:
- the value read by the read operation
- Throws:
Exception- if a problem occurs with the underlying storage engine
-
read
Executes a read operation. In case of a read operation rollback, implementations must ensure the read operation is retried until it succeeds.- Type Parameters:
T- type of the value returned- Parameters:
config- the config to apply to this transactionreadOperation- the read operation to execute- Returns:
- the value read by the read operation
- Throws:
Exception- if a problem occurs with the underlying storage engine
-
write
Executes a write operation. In case of a write operation rollback, implementations must ensure the write operation is retried until it succeeds.- Parameters:
writeOperation- the write operation to execute- Throws:
Exception- if a problem occurs with the underlying storage engine
-
write
Executes a write operation. In case of a write operation rollback, implementations must ensure the write operation is retried until it succeeds.- Parameters:
config- the config to apply to this transactionwriteOperation- the write operation to execute- Throws:
Exception- if a problem occurs with the underlying storage engine
-
removeStorageFiles
Remove all files for a backend of this storage.- Throws:
StorageException- if removal fails
-
getStorageStatus
StorageStatus getStorageStatus()Returns the current status of the storage.- Returns:
- the current status of the storage
-
checkStorageIsAvailableOrThrow
Ensures the provided Storage instance is available. When server is running, disk space is monitored and underlying storage will switch to an unavailable status if the disk run low on space. One reason this could happen is because aReadOperationorWriteOperation(e.g.:backendstatorverify-index) has been kept open for too long, preventing storage to purge garbage data. Another reason for an unavailable status is when the storage engine detects it is not in a valid state, such as when a latch timeout occurs or threads are interrupted- Throws:
StorageException- if the providedstorageis not available.- See Also:
-
checkStorageStatusAfterError
default void checkStorageStatusAfterError()Performs a self-check of the storage engine and update the storage status accordingly. -
listTreeNames
Lists the trees that exist in this storage.- Returns:
- a set of
TreeNames representing the trees that exist in this storage - Throws:
StorageException- if a problem occurs with the underlying storage engine
-
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-