Interface Storage

All Superinterfaces:
AutoCloseable, Backupable, Closeable
All Known Implementing Classes:
JEStorage

public interface Storage extends Backupable, Closeable
This interface abstracts the underlying storage engine, isolating the pluggable backend generic code from a particular storage engine implementation.
  • Field Details

  • Method Details

    • 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 configuration
      StorageRuntimeException - if a problem occurs with the underlying storage engine
      See Also:
    • open

      void open(AccessMode accessMode) throws Exception
      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

      default <T> T read(ReadOperation<T> readOperation) throws Exception
      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

      <T> T read(Set<Storage.ReadHint> hints, ReadOperation<T> readOperation) throws Exception
      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:
      hints - the hints to apply to this transaction
      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
    • write

      default void write(WriteOperation writeOperation) throws Exception
      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

      void write(Set<Storage.ReadWriteHint> hints, WriteOperation writeOperation) throws Exception
      Executes a write operation. In case of a write operation rollback, implementations must ensure the write operation is retried until it succeeds.
      Parameters:
      hints - the hints to apply to this transaction
      writeOperation - the write operation to execute
      Throws:
      Exception - if a problem occurs with the underlying storage engine
    • removeStorageFiles

      void removeStorageFiles() throws StorageRuntimeException
      Remove all files for a backend of this storage.
      Throws:
      StorageRuntimeException - if removal fails
    • getStorageStatus

      StorageStatus getStorageStatus()
      Returns the current status of the storage.
      Returns:
      the current status of the storage
    • checkStorageIsAvailableOrThrow

      default void 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 a ReadOperation or WriteOperation (e.g.: backendstat or verify-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:
      StorageRuntimeException - if the provided storage is not available.
      See Also:
    • checkStorageStatusAfterError

      default void checkStorageStatusAfterError()
      Performs a self-check of the storage engine and update the storage status accordingly.
    • listTreeNames

      Set<TreeName> listTreeNames()
      Lists the trees that exist in this storage.
      Returns:
      a set of TreeNames representing the trees that exist in this storage
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable