public class CompressBackupUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
archiveFile(@NotNull org.apache.commons.compress.archivers.ArchiveOutputStream out,
@NotNull jetbrains.exodus.backup.VirtualFileDescriptor source,
long fileSize)
Adds the file to the tar archive represented by output stream.
|
static @NotNull java.io.File |
backup(@NotNull jetbrains.exodus.backup.Backupable source,
@NotNull java.io.File target,
boolean zip)
For specified Backupable
source and target backup file, does backup. |
static @NotNull java.io.File |
backup(@NotNull jetbrains.exodus.backup.Backupable source,
@NotNull java.io.File backupRoot,
@Nullable java.lang.String backupNamePrefix,
boolean zip)
For specified Backupable
source, creates backup file in the specified backupRoot
directory whose name is calculated using current timestamp and specified backupNamePrefix if it is not
null. |
static @NotNull java.io.File |
backup(@NotNull jetbrains.exodus.backup.BackupBean backupBean)
For specified BackupBean, creates a backup file using Backupables decorated by the bean
and the setting provided by the bean (backup path, prefix, zip or tar.gz).
|
static @NotNull java.lang.String |
getTimeStampedTarGzFileName() |
static @NotNull java.lang.String |
getTimeStampedZipFileName() |
static void |
tar(@NotNull java.io.File source,
@NotNull java.io.File dest)
Compresses the content of source and stores newly created archive in dest.
|
@NotNull
public static @NotNull java.io.File backup(@NotNull
@NotNull jetbrains.exodus.backup.Backupable source,
@NotNull
@NotNull java.io.File backupRoot,
@Nullable
@Nullable java.lang.String backupNamePrefix,
boolean zip)
throws java.lang.Exception
source, creates backup file in the specified backupRoot
directory whose name is calculated using current timestamp and specified backupNamePrefix if it is not
null. Typically, source is an Environment or an PersistentEntityStore
instance. Set zip = true to create .zip backup file, otherwise .tar.gz file will be created.
Environment and PersistentEntityStore instances don't require any specific actions (like, e.g., switching to read-only mode) to do backups and get consistent copies of data within backups files. So backup can be performed on-the-fly not affecting database operations.
source - an instance of BackupablebackupRoot - a directory which the backup file will be created inbackupNamePrefix - prefix of the backup file namezip - true to create .zip backup file, rather than .tar.gz onejava.lang.Exception - something went wrong@NotNull
public static @NotNull java.io.File backup(@NotNull
@NotNull jetbrains.exodus.backup.BackupBean backupBean)
throws java.lang.Exception
backupBean - bean holding one or several Backupables and the settings
describing how to create backup file (backup path, prefix, zip or tar.gz)java.lang.Exception - something went wrongBackupBean,
BackupBean.getBackupPath(),
BackupBean.getBackupNamePrefix(),
BackupBean.getBackupToZip()@NotNull
public static @NotNull java.io.File backup(@NotNull
@NotNull jetbrains.exodus.backup.Backupable source,
@NotNull
@NotNull java.io.File target,
boolean zip)
throws java.lang.Exception
source and target backup file, does backup.
Typically, source is an Environment or an PersistentEntityStore
instance. Set zip = true to create .zip backup file, otherwise .tar.gz file will be created.
Environment and PersistentEntityStore instances don't require any specific actions (like, e.g., switching to read-only mode) to do backups and get consistent copies of data within backups files. So backup can be performed on-the-fly not affecting database operations.
source - an instance of Backupabletarget - target backup file (either .zip or .tag.gz)zip - true to create .zip backup file, rather than .tar.gz onetargetjava.lang.Exception - something went wrong@NotNull public static @NotNull java.lang.String getTimeStampedTarGzFileName()
@NotNull public static @NotNull java.lang.String getTimeStampedZipFileName()
public static void tar(@NotNull
@NotNull java.io.File source,
@NotNull
@NotNull java.io.File dest)
throws java.io.IOException
source - file or folder to be archived. Should exist on method call.dest - path to the archive to be created. Should not exist on method call.java.io.IOException - in case of any issues with underlying store.java.io.FileNotFoundException - in case source does not exist.public static void archiveFile(@NotNull
@NotNull org.apache.commons.compress.archivers.ArchiveOutputStream out,
@NotNull
@NotNull jetbrains.exodus.backup.VirtualFileDescriptor source,
long fileSize)
throws java.io.IOException
out - target archive.source - file to be added.fileSize - size of the file (which is known in most cases).java.io.IOException - in case of any issues with underlying store.