Package com.aoindustries.aoserv.backup
Interface BackupEnvironment
- All Known Implementing Classes:
FileEnvironment
,LinuxEnvironment
,MacOsXEnvironment
,PosixFileEnvironment
,WindowsEnvironment
public interface BackupEnvironment
A
BackupEnvironment
tells the BackupDaemon
how to run.
All paths are represented as a String
to allow anything to be backed-up, not just local files.
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup
(FileReplication ffr) Called in a finally block after any backup-pass completes, no data will be obtained from the environment after this is called.Gets the connection to the master server.Gets the default source IP address orInetAddress.UNSPECIFIED
to use the system default.long
getDeviceIdentifier
(FileReplication ffr, String filename) Gets the device file major and minor.String[]
getDirectoryList
(FileReplication ffr, String filename) Gets the listing for a directory.int
Gets the number of items per batch.A fast pseudo-random number generator for non-cryptographic purposes.Gets theIterator
of filenames ornull
if completed.int
getGid
(FileReplication ffr, String filename) Gets the group ID.getInputStream
(FileReplication ffr, String filename) Gets a stream reading the file.long
getLength
(FileReplication ffr, String filename) Gets the length of the file.Gets the logger for this environment.long
getModifyTime
(FileReplication ffr, String filename) Gets the modified time.getNameOfFile
(FileReplication ffr, String filename) Gets the name of a file (the part after the last slash).Gets the list of MySQL server versions (in the same order as the list returned bygetReplicatedMysqlServers
.Gets the list of MySQL server instance names that are being replicated.Gets the set of paths that must be found in the backup set.getServerPath
(FileReplication ffr, String filename) Converts an environment-specific filename into a server path.long
getStatMode
(FileReplication ffr, String filename) Gets the stat mode (or a generated and equivalent one) for a file.Gets the host this process is running on.int
getUid
(FileReplication ffr, String filename) Gets the user ID.void
init
(FileReplication ffr) Called before any backup-pass data is retrieved from the environment.void
Called right after a backup pass ends.void
preBackup
(FileReplication ffr) Called right before a backup pass begins.readLink
(FileReplication ffr, String filename) Reads a symbolic link.
-
Method Details
-
getStatMode
Gets the stat mode (or a generated and equivalent one) for a file.- Throws:
IOException
-
getDirectoryList
Gets the listing for a directory.- Throws:
IOException
-
getUid
Gets the user ID.- Throws:
IOException
-
getGid
Gets the group ID.- Throws:
IOException
-
getModifyTime
Gets the modified time.- Throws:
IOException
-
getLength
Gets the length of the file.- Throws:
IOException
-
readLink
Reads a symbolic link.- Throws:
IOException
-
getDeviceIdentifier
Gets the device file major and minor.- Throws:
IOException
-
getInputStream
Gets a stream reading the file.- Throws:
IOException
-
getNameOfFile
Gets the name of a file (the part after the last slash). -
getConnector
Gets the connection to the master server.- Throws:
IOException
SQLException
-
getThisHost
Gets the host this process is running on.- Throws:
IOException
SQLException
-
getFailoverBatchSize
Gets the number of items per batch. A higher value will consume more RAM but better hide latency.- Throws:
IOException
SQLException
-
preBackup
Called right before a backup pass begins. Implementations should call super.preBackup first.The process is:
- preBackup
- init
- cleanup (always)
- postBackup (only when backup pass successful)
- Throws:
IOException
SQLException
-
init
Called before any backup-pass data is retrieved from the environment.cleanup()
will also be called in a finally block. Implementations should call super.init first.- Throws:
IOException
SQLException
- See Also:
-
cleanup
Called in a finally block after any backup-pass completes, no data will be obtained from the environment after this is called. Implementations should call super.cleanup in a finally block.- Throws:
IOException
SQLException
- See Also:
-
postBackup
Called right after a backup pass ends. Implementations should call super.postBackup last.- Throws:
IOException
SQLException
- See Also:
-
getRequiredFilenames
Gets the set of paths that must be found in the backup set. These paths must not include any trailing separators.- Throws:
IOException
SQLException
-
getFilenameIterator
Gets theIterator
of filenames ornull
if completed.- Throws:
IOException
SQLException
-
getDefaultSourceIpAddress
Gets the default source IP address orInetAddress.UNSPECIFIED
to use the system default.- Throws:
IOException
SQLException
-
getReplicatedMysqlServers
Gets the list of MySQL server instance names that are being replicated. This is only used for failover mode (retention == 1), and should only be used for a replication that includes MySQL replication (Server only)- Throws:
IOException
SQLException
- See Also:
-
getReplicatedMysqlMinorVersions
Gets the list of MySQL server versions (in the same order as the list returned bygetReplicatedMysqlServers
. This is only used for failover mode (retention == 1), and should only be used for a replication that includes MySQL replication (Server only)- Throws:
IOException
SQLException
- See Also:
-
getFastRandom
Random getFastRandom()A fast pseudo-random number generator for non-cryptographic purposes.Gets a Random source for the backup daemon. This does not need to be cryptographically strong because it is only used to randomize some sleep times to distribute load on the server processes.
-
getLogger
Logger getLogger()Gets the logger for this environment. -
getServerPath
Converts an environment-specific filename into a server path. The server path must begin with /, may not contain /../, and must use / as the path separator.
-