class

Sepia::Backup

Inherits Reference < Object

Class methods

create(root_objects : Array(Sepia::Object), output_path : String, config : Configuration) : String

Create backup with custom configuration

Source
create(root_objects : Array(Sepia::Object), output_path : String) : String

Main backup class methods

Source
get_metadata(backup_path : String) : BackupManifest

Extracts metadata from a backup file

Source
list_contents(backup_path : String) : BackupManifest

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

  • BackupCorruptionError if the backup file is corrupted or missing metadata
Source
restore(backup_path : String, target_storage_path : String | Nil = nil) : Array(Sepia::Object)

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.

Source
verify(backup_path : String) : BackupVerificationResult

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

  • BackupCorruptionError if the backup file is severely corrupted
Source

Nested types