class
Sepia::Backup
- Sepia::Backup
- Reference
- Object
Defined in:
sepia/backup.crClass Method Summary
-
.create(root_objects : Array(Sepia::Object), output_path : String, config : Configuration) : String
Create backup with custom configuration
-
.create(root_objects : Array(Sepia::Object), output_path : String) : String
Main backup class methods
-
.get_metadata(backup_path : String) : BackupManifest
Extracts metadata from a backup file
-
.list_contents(backup_path : String) : BackupManifest
Lists contents of a backup without restoring
-
.restore(backup_path : String, target_storage_path : String | Nil = nil) : Array(Sepia::Object)
Restores objects from a backup archive
-
.verify(backup_path : String) : BackupVerificationResult
Verifies backup integrity and structure
Class Method Detail
Create backup with custom configuration
Main backup class methods
Lists contents of a backup without restoring
This method allows applications to inspect what objects are contained in a backup archive without performing a full restore. It extracts and parses the metadata to return information about the backup contents.
Parameters
- backup_path : Path to the backup tar file
Returns
A BackupManifest containing information about the backup contents
Example
# Inspect backup contents
manifest = Sepia::Backup.list_contents("user_backup.tar")
puts "Backup created: #{manifest.created_at}"
puts "Contains #{manifest.all_objects.values.map(&.size).sum} objects"
puts "Root objects: #{manifest.root_objects.map(&.object_id).join(", ")}"
Raises
BackupCorruptionErrorif the backup file is corrupted or missing metadata
Restores objects from a backup archive
This method is left for application-specific implementations as restore logic varies greatly depending on business requirements, data migration policies, and application-specific validation rules.
Parameters
- backup_path : Path to the backup tar file
- target_storage_path : Optional target storage path
Returns
Array of restored Sepia::Object instances
Note
This method raises NotImplementedError as restore functionality should be implemented by applications based on their specific requirements.
Verifies backup integrity and structure
This method checks that the backup file is well-formed and that all expected files are present and readable. It provides detailed information about the backup contents and any issues found.
Parameters
- backup_path : Path to the backup tar file
Returns
A BackupVerificationResult containing verification status and statistics
Example
result = Sepia::Backup.verify("user_backup.tar")
if result.valid
puts "Backup is valid"
puts "Contains #{result.statistics.total_objects} objects"
else
puts "Backup has issues:"
result.errors.each { |error| puts " - #{error}" }
end
Raises
BackupCorruptionErrorif the backup file is severely corrupted