Class CacheResource
- java.lang.Object
-
- org.infinispan.server.core.backup.resources.CacheResource
-
- All Implemented Interfaces:
ContainerResource
public class CacheResource extends Object
ContainerResource
implementation forBackupManager.Resources.Type.CACHES
.- Since:
- 12.0
- Author:
- Ryan Emerson
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheResource.CacheBackupEntry
ProtoStream entity used to represent individual cache entries.
-
Field Summary
Fields Modifier and Type Field Description protected BlockingManager
blockingManager
protected static Log
log
protected BackupManager.Resources
params
protected Set<String>
resources
protected Path
root
protected BackupManager.Resources.Type
type
protected boolean
wildcard
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>
backup()
Writes the backup files for theBackupManager.Resources.Type
to the local filesystem, where it can then be packaged for distribution.protected void
mkdirs(Path path)
void
prepareAndValidateBackup()
A method to ensure that the resources requested in theBackupManager.Resources
are valid and can be included in a backup.void
prepareAndValidateRestore(Properties properties)
A method to ensure that the resources requested in theBackupManager.Resources
are contained in the backup to be restored.protected static <T> T
readMessageStream(org.infinispan.protostream.ImmutableSerializationContext ctx, Class<T> clazz, DataInputStream is)
CompletionStage<Void>
restore(ZipFile zip)
Restores theBackupManager.Resources.Type
content from the providedZipFile
to the target container.protected static void
writeMessageStream(Object o, org.infinispan.protostream.ImmutableSerializationContext serCtx, DataOutputStream output)
void
writeToManifest(Properties properties)
Writes the name of the individual resources that have been included in this backup.
-
-
-
Field Detail
-
log
protected static final Log log
-
type
protected final BackupManager.Resources.Type type
-
params
protected final BackupManager.Resources params
-
root
protected final Path root
-
blockingManager
protected final BlockingManager blockingManager
-
wildcard
protected final boolean wildcard
-
-
Method Detail
-
prepareAndValidateBackup
public void prepareAndValidateBackup()
Description copied from interface:ContainerResource
A method to ensure that the resources requested in theBackupManager.Resources
are valid and can be included in a backup. This method is called for allContainerResource
implementations before the backup process begins in order to allow a backup to fail-fast before any data is processed.
-
backup
public CompletionStage<Void> backup()
Description copied from interface:ContainerResource
Writes the backup files for theBackupManager.Resources.Type
to the local filesystem, where it can then be packaged for distribution.Implementations of this method depend on content created by
ContainerResource.prepareAndValidateBackup()
.- Returns:
- a
CompletionStage
that completes once the backup of thisBackupManager.Resources.Type
has finished.
-
restore
public CompletionStage<Void> restore(ZipFile zip)
Description copied from interface:ContainerResource
Restores theBackupManager.Resources.Type
content from the providedZipFile
to the target container.- Parameters:
zip
- theZipFile
to restore content from.- Returns:
- a
CompletionStage
that completes once the restoration of thisBackupManager.Resources.Type
has finished.
-
writeToManifest
public void writeToManifest(Properties properties)
Description copied from interface:ContainerResource
Writes the name of the individual resources that have been included in this backup. TheBackupManager.Resources.Type
associated with an implementation is the key, whilst the value is a csv of resource names.Implementations of this method depend on state created by
ContainerResource.backup()
.- Specified by:
writeToManifest
in interfaceContainerResource
- Parameters:
properties
- theProperties
instance to add the key/value property.
-
prepareAndValidateRestore
public void prepareAndValidateRestore(Properties properties)
Description copied from interface:ContainerResource
A method to ensure that the resources requested in theBackupManager.Resources
are contained in the backup to be restored. This method is called for allContainerResource
implementations before the restore process begins in order to allow a restore to fail-fast before any state is restored to a container.- Specified by:
prepareAndValidateRestore
in interfaceContainerResource
-
mkdirs
protected void mkdirs(Path path)
-
writeMessageStream
protected static void writeMessageStream(Object o, org.infinispan.protostream.ImmutableSerializationContext serCtx, DataOutputStream output) throws IOException
- Throws:
IOException
-
readMessageStream
protected static <T> T readMessageStream(org.infinispan.protostream.ImmutableSerializationContext ctx, Class<T> clazz, DataInputStream is) throws IOException
- Throws:
IOException
-
-