class ArchivedRemoteObject::Archive::ArchivedObject

Constants

CantBeRestoredError
CantStopArchivingOnDurationError

Attributes

remote_object[RW]

Public Class Methods

new( key:, remote_object: AwsS3::ArchivedObject.new(key: key) ) click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 9
def initialize(
  key:,
  remote_object: AwsS3::ArchivedObject.new(key: key)
)
  self.remote_object = remote_object
end

Public Instance Methods

archived?() click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 16
def archived?
  remote_object.archived?
end
available?() click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 44
def available?
  !archived? || restored?
end
debug_state() click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 52
def debug_state
  {
    restore_in_progress: restore_in_progress?,
    restored: restored?,
    **remote_object.debug_state
  }
end
restore() click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 32
def restore
  raise CantBeRestoredError if available? || restore_in_progress?

  remote_object.restore
end
restore_in_progress?() click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 20
def restore_in_progress?
  return false unless archived?

  remote_object.restore_in_progress?
end
restored?() click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 26
def restored?
  return false unless archived?

  remote_object.restored?
end
stop_archiving_on_duration() click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 38
def stop_archiving_on_duration
  raise CantStopArchivingOnDurationError if !restored? || restore_in_progress?

  remote_object.stop_archiving_on_duration
end
sync() click to toggle source
# File lib/archived_remote_object/archive/archived_object.rb, line 48
def sync
  tap { remote_object.sync }
end