public abstract class AbstractSnapshotArchiver extends Object implements SnapshotArchiver
SnapshotArchiver which must be extended to create a specific implementation.| Modifier and Type | Field and Description |
|---|---|
protected String |
f_sClusterName
The cluster name.
|
protected String |
f_sServiceName
The service name.
|
protected long |
m_cMillisLastStart
The start time of the last operation.
|
protected long |
m_cMillisMax
The maxiumum time in millis to archive or retrieve a snapshot store.
|
protected long |
m_cMillisMin
The minimum time in millis to archive or retrieve a snapshot store.
|
protected long |
m_cMillisTotal
The total time in millis taken to archive or retrieve snapshot stores.
|
| Constructor and Description |
|---|
AbstractSnapshotArchiver(String sClusterName, String sServiceName)
Create a new AbstractSnapshotArchiver which is used to archive and retrieve snapshot parts to/from a common archive location.
|
| Modifier and Type | Method and Description |
|---|---|
void |
archive(Snapshot snapshot, com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer> env)
Archive the specified snapshot.
|
protected abstract void |
archiveInternal(Snapshot snapshot, com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer> mgr)
Internal implementation to Archive the specified snapshot.
|
protected com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer> |
createTempEnvironment(File fileBaseDir, String sStorageFormat)
Create a temporary PersistenceEnvironment to write archived snapshots to in the given format.
|
protected void |
displayStatistics(Snapshot snapshot, String sType)
Display the collected statistics for the given snapshot and type of operation.
|
Snapshot |
get(String sSnapshot)
Return a
Snapshot which represents the archived snapshot with the given identifier. |
protected abstract Properties |
getMetadata(String sSnapshot)
Internal implementation to retrieve the metadata stored for the archived snapshot.
|
com.oracle.datagrid.persistence.PersistenceTools |
getPersistenceTools(String sSnapshot)
Return an instance of
PersistenceTools allowing offline operations to be performed against the associated PersistenceManager and appropriate PersistentStore. |
protected boolean |
hasArchivedSnapshot(String sSnapshot)
Return true if the specified snapshot exists for this archiver.
|
protected boolean |
hasLocalSnapshot(com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer> env, String sSnapshot)
Return true if the specified snapshot exists for the PersistenceEnvironment.
|
protected com.oracle.datagrid.persistence.PersistenceTools |
instantiatePersistenceTools(com.oracle.datagrid.persistence.OfflinePersistenceInfo info, String sSnapshot)
Instantiate an instance of
PersistenceTools relevant to this archiver and the provided snapshot. |
String[] |
list()
Return the identifiers of the archived snapshots known to this archiver.
|
protected abstract String[] |
listInternal()
Internal implementation to return the identifiers of the archived snapshots known to this archiver.
|
protected abstract String[] |
listStoresInternal(String sSnapshot)
List the stores for a given snapshot.
|
protected void |
recordEndTime()
Record the end time of the operation and update min and max values.
|
protected void |
recordStartTime()
Record the start time of the operation.
|
boolean |
remove(String sSnapshot)
Remove the archived snapshot with the specified identifier.
|
protected abstract boolean |
removeInternal(String sSnapshot)
Internal implementation to remove the specified archived snapshot.
|
protected void |
resetStatistics()
Reset the statistics recording the archive and retrieve times.
|
void |
retrieve(Snapshot snapshot, com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer> env)
Retrieve the specified archived snapshot.
|
protected abstract void |
retrieveInternal(Snapshot snapshot, com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer> mgr)
Internal implementation to retrieve the specified snapshot.
|
String |
toString() |
protected void |
writeMetadata(File fileDir, com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer> mgr, String sStore)
Write the metadata using given manager for a particular store to a destination directory.
|
protected final String f_sClusterName
protected final String f_sServiceName
protected long m_cMillisTotal
protected long m_cMillisMax
protected long m_cMillisMin
protected long m_cMillisLastStart
public AbstractSnapshotArchiver(String sClusterName, String sServiceName)
sClusterName - the name of the clustersServiceName - the service namepublic String[] list()
SnapshotArchiverlist in interface SnapshotArchiverpublic Snapshot get(String sSnapshot)
SnapshotArchiverSnapshot which represents the archived snapshot with the given identifier.get in interface SnapshotArchiversSnapshot - the identifier of the archived snapshotSnapshotpublic boolean remove(String sSnapshot)
SnapshotArchiverremove in interface SnapshotArchiversSnapshot - the identifier of the archived snapshotpublic void archive(Snapshot snapshot, com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer> env)
SnapshotArchiverarchive in interface SnapshotArchiversnapshot - the snapshot to archiveenv - the PersistenceEnvironment used to read the snapshotpublic void retrieve(Snapshot snapshot, com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer> env)
SnapshotArchiverretrieve in interface SnapshotArchiversnapshot - the snapshot to retrieveenv - the PersistenceEnvironment used to write the snapshotpublic com.oracle.datagrid.persistence.PersistenceTools getPersistenceTools(String sSnapshot)
SnapshotArchiverPersistenceTools allowing offline operations to be performed against the associated PersistenceManager and appropriate PersistentStore.getPersistenceTools in interface SnapshotArchiversSnapshot - the snapshot to return tools forprotected abstract String[] listInternal()
protected abstract void archiveInternal(Snapshot snapshot, com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer> mgr)
snapshot - the snapshot to archivemgr - the PersistenceManager used to read the stores fromprotected abstract void retrieveInternal(Snapshot snapshot, com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer> mgr)
snapshot - the snapshot to retrievemgr - the PersistenceManager used to write the stores toprotected abstract boolean removeInternal(String sSnapshot)
sSnapshot - the snapshot name to removeprotected abstract String[] listStoresInternal(String sSnapshot)
sSnapshot - the snapshot name to list stores forString[] of store namesprotected abstract Properties getMetadata(String sSnapshot) throws IOException
sSnapshot - the snapshot name to retrieve metadataIOException - if any I/O related problems
protected com.oracle.datagrid.persistence.PersistenceTools instantiatePersistenceTools(com.oracle.datagrid.persistence.OfflinePersistenceInfo info,
String sSnapshot)
PersistenceTools relevant to this archiver and the provided snapshot.info - the information about this archived snapshotsSnapshot - the snapshot name to useprotected void resetStatistics()
protected void recordStartTime()
protected void recordEndTime()
protected void displayStatistics(Snapshot snapshot, String sType)
snapshot - the snapshot that was archived or retrievedsType - the type of operation, either "archive" or "retrieve"protected boolean hasLocalSnapshot(com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer> env, String sSnapshot)
env - the PersistenceEnvironment to querysSnapshot - the snapshot name to check forprotected boolean hasArchivedSnapshot(String sSnapshot)
sSnapshot - the snapshot name to check forprotected com.oracle.datagrid.persistence.PersistenceEnvironment<ReadBuffer> createTempEnvironment(File fileBaseDir, String sStorageFormat) throws IOException
fileBaseDir - the directory off which to create the environmentsStorageFormat - the storage format to useIOException - if any I/O related errors.protected void writeMetadata(File fileDir, com.oracle.datagrid.persistence.PersistenceManager<ReadBuffer> mgr, String sStore) throws IOException
fileDir - the directory to write metadata tomgr - the PersistenceManager used to write the metadatasStore - a store to use to read the partition count fromIOException - if any errors writing metadata