Interface Storage

    • Method Detail

      • read

        <T> T read​(ReadOperation<T> readOperation)
            throws Exception
        Executes a read operation. In case of a read operation rollback, implementations must propagate the failure to the caller rather than replay the operation: unlike WriteOperation, a ReadOperation is not required to be idempotent, and several of them are not - they write to a stream, print, or accumulate state that a second attempt would double.
        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
      • write

        void write​(WriteOperation writeOperation)
            throws Exception
        Executes a write operation. In case of a write operation rollback, implementations may replay the write operation rather than propagate the failure: a WriteOperation is required to be idempotent for exactly that reason. A replay may be bounded - by a number of attempts, by a window of time, or by both - so that a conflict which does not clear reaches the caller, or may go on for as long as the conflict lasts, the way a writer of a lock based engine waits for a lock; an engine which resolves every conflict by a rollback should bound it by time only, since a healthy write under concurrent load loses several in a row. The pluggable backend holds locks across this method, up to the exclusive lock of an entry container, and every thread waiting on one of those locks waits for as long as this method does.

        A caller that mutates state around this method must handle that bound being spent. Removing an entry from an in-memory map before the write so that a replay still finds the work to do, or reading configuration back out of the operation once it returns, both assume the write is applied; when it is not, this method throws with that state already changed and the transaction not applied, and the caller is the only place that can reconcile the two.

        Parameters:
        writeOperation - the write operation to execute
        Throws:
        Exception - if a problem occurs with the underlying storage engine, including a conflict that outlasted the replays the implementation makes
      • getStorageStatus

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

        boolean supportsBackupAndRestore()
        Returns true if this storage supports backup and restore.
        Returns:
        true if this storage supports backup and restore.
      • createBackup

        void createBackup​(BackupConfig backupConfig)
                   throws DirectoryException
        Creates a backup for this storage.
        Parameters:
        backupConfig - The configuration to use when performing the backup.
        Throws:
        DirectoryException - If a Directory Server error occurs.
      • removeBackup

        void removeBackup​(BackupDirectory backupDirectory,
                          String backupID)
                   throws DirectoryException
        Removes a backup for this storage.
        Parameters:
        backupDirectory - The backup directory structure with which the specified backup is associated.
        backupID - The backup ID for the backup to be removed.
        Throws:
        DirectoryException - If it is not possible to remove the specified backup.
      • restoreBackup

        void restoreBackup​(RestoreConfig restoreConfig)
                    throws DirectoryException
        Restores a backup for this storage.
        Parameters:
        restoreConfig - The configuration to use when performing the restore.
        Throws:
        DirectoryException - If a Directory Server error occurs.
      • listTrees

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