public interface BackupFileCopy
| Modifier and Type | Method and Description |
|---|---|
byte[] |
checksum(URL archiveURL)
Returns the checksum computed by reading archiveFile.
|
byte[] |
copy(File localFile,
URL archiveURL)
Copies the file from the local machine into the archive.
|
String |
getChecksumAlg()
Returns the checksum algorithm used to checksum the archive file
being accessed.
|
String |
getCompressionAlg()
Returns the compression algorithm used to compress the archive file
being accessed.
|
String |
getEncryptionAlg()
Returns the encryption algorithm used to encrypt/decrypt the archive
file being accessed.
|
void |
initialize(File configFile)
initialize is invoked exactly once after the creation of the object via
its noargs constructor.
|
void initialize(File configFile) throws InterruptedException, IOException
configFile - the config file used to initialize the object. It
could, for example, contain the credentials needed to access the
archive,the compression and encryption algorithms used to store archive
files, etc. The format of the config file (properties, json, etc.) is
private to the implementation.InterruptedException - if the initialize operation is interruptedIllegalArgumentException - if the configuration was invalidIOException - if some irrecoverable I/O issue was encountered
during initialization.String getEncryptionAlg()
initialize(java.io.File). The algorithm name is a valid
argument to Cipher or the
provider overloading used by the implementation.String getCompressionAlg()
initialize(java.io.File).String getChecksumAlg()
initialize(java.io.File). The algorithm name is a valid
argument to MessageDigest.getInstance(String) or
the provider overloading used by the implementation.byte[] copy(File localFile, URL archiveURL) throws InterruptedException, IOException
initialize(java.io.File).
Note that localFile could be modified concurrently (for table
row erasure) while the copy operation is in progress, so that the
version of file that is copied is partially erased. Erasure
modifications do not change the length of the file, just its existing
contents. The restored environment is resilient to such pa partially
erased state. The checksum returned for such a concurrently erased file
thus reflects the contents of the file in the archive and will not match
the state of the localFile.
If archiveFile already exists at archiveURL, say because of an
earlier aborted attempt, the file is overwritten by the copy operation.
The overwrite need not be atomic. The implementation can delete the
partial archiveFile before copying it anew.
An IOException may leave the archiveFile in an inconsistent state. For
example, the archive storage may become unavailable, fail, etc. The
caller is expected to be handle such failures and not trust the archive
file contents (if the file exists at all) following an IOException.
If archive storage has the notion of a container, like a directory, or a
storage bucket, the implementation may create the container before
creating the file, or arrange for the container to be in place before
backup is enabled.localFile - the file to be copiedarchiveURL - the target path for the copy; it must be an absolute
URLInterruptedException - if the copy is interruptedIOException - if some irrecoverable I/O issue was encountered
either while reading or writing the file.byte[] checksum(URL archiveURL) throws InterruptedException, IOException
initialize(java.io.File)archiveURL - the archive file being read to compute the checksum
value; it must be an absolute URLInterruptedException - if the checksum operation is interruptedIOException - if some irrecoverable I/O issue was encountered
while reading the archiveFileCopyright © 2024. All rights reserved.