Archive instance wrapping the merged archive.Archive.merge
Archive merge(Archive base, Archive other, string outDir, string mergedBase,
string ext, MergeOpts mo) @safeMerges two archives into a new combined archive.
This static factory merges a base archive with a secondary (differential or incremental) archive to produce a new merged archive. The merged archive contains the combined contents of both source archives.
Parameters
base | the base archive (typically a full backup) |
other | the secondary archive to merge (typically incremental/differential) |
outDir | directory where the merged archive slices are written |
mergedBase | base name for the new merged archive |
ext | slice extension (e.g., "dar") |
mo | merge options specifying compression, slicing, etc. |
Returns
A new
Throws
DarException if merging fails (invalid archives, I/O error,
permission denied, or other libdar-reported errors).
Example:
import ddn.wrp.dar;
// Open two existing archives
auto ro = readOpts().withExtension("dar").toLow();
auto baseArc = Archive.open("/backups", "full_backup", "dar", ro);
auto incrArc = Archive.open("/backups", "incr_backup", "dar", ro);
// Merge them with compression
auto mo = mergeOpts()
.withCompression(DarCompression.GZIP)
.withCompressionLevel(6);
auto merged = Archive.merge(baseArc, incrArc, "/backups", "merged", "dar", mo);Archive merge(Archive base, Archive other, string outDir, string mergedBase,
string ext, MergeOptions mo) @safeMerges two archives into a new combined archive using low-level options.
This overload accepts low-level MergeOptions directly for cases where more control is needed.
Parameters
base | the base archive |
other | the secondary archive to merge |
outDir | directory where the merged archive slices are written |
mergedBase | base name for the new merged archive |
ext | slice extension (e.g., "dar") |
mo | low-level merge options |
Returns
A new
Archive instance wrapping the merged archive.Throws
DarException if merging fails.Merges two archives into a new combined archive using default options.
This is a convenience overload that uses default merge settings (no compression, no slicing).
Parameters
base | the base archive |
other | the secondary archive to merge |
outDir | directory where the merged archive slices are written |
mergedBase | base name for the new merged archive |
ext | slice extension (e.g., "dar") |
Returns
A new
Archive instance wrapping the merged archive.Throws
DarException if merging fails.