Class CASStorage
- java.lang.Object
-
- org.opends.server.backends.cassandra.CASStorage
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ConfigurationChangeListener<CASBackendCfg>,Storage
public class CASStorage extends Object implements Storage, ConfigurationChangeListener<CASBackendCfg>
-
-
Constructor Summary
Constructors Constructor Description CASStorage(CASBackendCfg cfg, ServerContext serverContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResultapplyConfigurationChange(CASBackendCfg cfg)Applies the configuration changes to this change listener.voidclose()voidcreateBackup(BackupConfig backupConfig)Creates a backup for this storage.StorageStatusgetStorageStatus()Returns the current status of the storage.booleanisConfigurationChangeAcceptable(CASBackendCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.Set<TreeName>listTrees()Lists the trees that exist in this storage.voidopen(AccessMode accessMode)Opens the storage engine to allow executing operations on it.<T> Tread(ReadOperation<T> readOperation)Executes a read operation.voidremoveBackup(BackupDirectory backupDirectory, String backupID)Removes a backup for this storage.voidremoveStorageFiles()Remove all files for a backend of this storage.voidrestoreBackup(RestoreConfig restoreConfig)Restores a backup for this storage.ImporterstartImport()Starts the import operation.booleansupportsBackupAndRestore()Returnstrueif this storage supports backup and restore.voidwrite(WriteOperation writeOperation)Executes a write operation.
-
-
-
Constructor Detail
-
CASStorage
public CASStorage(CASBackendCfg cfg, ServerContext serverContext)
-
-
Method Detail
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(CASBackendCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein interfaceConfigurationChangeListener<CASBackendCfg>- Parameters:
configuration- The new configuration containing the changes.unacceptableReasons- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(CASBackendCfg cfg)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<CASBackendCfg>- Parameters:
cfg- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
open
public void open(AccessMode accessMode) throws Exception
Description copied from interface:StorageOpens the storage engine to allow executing operations on it.- Specified by:
openin interfaceStorage- 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:
to release all resources once import is finished
-
getStorageStatus
public StorageStatus getStorageStatus()
Description copied from interface:StorageReturns the current status of the storage.- Specified by:
getStorageStatusin interfaceStorage- Returns:
- the current status of the storage
-
close
public void close()
-
removeStorageFiles
public void removeStorageFiles() throws StorageRuntimeExceptionDescription copied from interface:StorageRemove all files for a backend of this storage.- Specified by:
removeStorageFilesin interfaceStorage- Throws:
StorageRuntimeException- if removal fails
-
read
public <T> T read(ReadOperation<T> readOperation) throws Exception
Description copied from interface:StorageExecutes a read operation. In case of a read operation rollback, implementations must propagate the failure to the caller rather than replay the operation: unlikeWriteOperation, aReadOperationis 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.
-
write
public void write(WriteOperation writeOperation) throws Exception
Description copied from interface:StorageExecutes a write operation. In case of a write operation rollback, implementations may replay the write operation rather than propagate the failure: aWriteOperationis 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.
-
listTrees
public Set<TreeName> listTrees()
Description copied from interface:StorageLists the trees that exist in this storage.
-
startImport
public Importer startImport() throws ConfigException, StorageRuntimeException
Description copied from interface:StorageStarts the import operation.- Specified by:
startImportin interfaceStorage- Returns:
- a new Importer object which must be closed to release all resources
- Throws:
ConfigException- if there is a problem with the configurationStorageRuntimeException- if a problem occurs with the underlying storage engine- See Also:
to release all resources once import is finished
-
supportsBackupAndRestore
public boolean supportsBackupAndRestore()
Description copied from interface:StorageReturnstrueif this storage supports backup and restore.- Specified by:
supportsBackupAndRestorein interfaceStorage- Returns:
trueif this storage supports backup and restore.
-
createBackup
public void createBackup(BackupConfig backupConfig) throws DirectoryException
Description copied from interface:StorageCreates a backup for this storage.- Specified by:
createBackupin interfaceStorage- Parameters:
backupConfig- The configuration to use when performing the backup.- Throws:
DirectoryException- If a Directory Server error occurs.
-
removeBackup
public void removeBackup(BackupDirectory backupDirectory, String backupID) throws DirectoryException
Description copied from interface:StorageRemoves a backup for this storage.- Specified by:
removeBackupin interfaceStorage- 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
public void restoreBackup(RestoreConfig restoreConfig) throws DirectoryException
Description copied from interface:StorageRestores a backup for this storage.- Specified by:
restoreBackupin interfaceStorage- Parameters:
restoreConfig- The configuration to use when performing the restore.- Throws:
DirectoryException- If a Directory Server error occurs.
-
-