class Sepia::Backup

Defined in:

sepia/backup.cr

Class Method Summary

Class Method Detail

def self.create(root_objects : Array(Sepia::Object), output_path : String, config : Configuration) : String #

Create backup with custom configuration


[View source]
def self.create(root_objects : Array(Sepia::Object), output_path : String) : String #

Main backup class methods


[View source]
def self.get_metadata(backup_path : String) : BackupManifest #

Extracts metadata from a backup file


[View source]
def self.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


[View source]
def self.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.


[View source]
def self.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


[View source]