Class: Tartarus

Inherits:
Object
  • Object
show all
Defined in:
lib/tartarus.rb,
lib/tartarus/rb/version.rb,
lib/tartarus/remote_storage/null.rb,
lib/tartarus/remote_storage/glacier.rb,
lib/tartarus/archive_strategy/delete_all.rb,
lib/tartarus/remote_storage/glacier/file.rb,
lib/tartarus/archive_strategy/destroy_all.rb,
lib/tartarus/remote_storage/glacier/client.rb,
lib/tartarus/archive_strategy/extract_batch.rb,
lib/tartarus/archivable_collection_repository.rb,
lib/tartarus/remote_storage/glacier/csv_export.rb,
lib/tartarus/remote_storage/glacier/configuration.rb,
lib/tartarus/sidekiq/schedule_archiving_model_job.rb,
lib/tartarus/sidekiq/archive_model_with_tenant_job.rb,
lib/tartarus/remote_storage/glacier/register_upload.rb,
lib/tartarus/sidekiq/archive_model_without_tenant_job.rb,
lib/tartarus/archivable_item/sidekiq_cron_job_serializer.rb,
lib/tartarus/archive_strategy/delete_all_without_batches.rb,
lib/tartarus/archive_strategy/destroy_all_without_batches.rb,
lib/tartarus/archive_strategy/delete_all_using_limit_in_batches.rb

Defined Under Namespace

Modules: Rb, RemoteStorage, Sidekiq Classes: ArchivableCollectionRepository, ArchivableItem, ArchiveModelWithTenant, ArchiveModelWithoutTenant, ArchiveStrategy, Registry, Repository, ScheduleArchivingModel

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository: Tartarus::Repository.new(backend: ::Sidekiq::Cron::Job)) ⇒ Tartarus

Returns a new instance of Tartarus.



33
34
35
36
# File 'lib/tartarus.rb', line 33

def initialize(repository: Tartarus::Repository.new(backend: ::Sidekiq::Cron::Job))
  @repository = repository
  @registry = self.class.registry
end

Class Method Details

.registryObject



29
30
31
# File 'lib/tartarus.rb', line 29

def self.registry
  @registry ||= Tartarus::Registry.new
end

Instance Method Details

#register {|item| ... } ⇒ Object

Yields:

  • (item)


38
39
40
41
42
43
44
# File 'lib/tartarus.rb', line 38

def register
  item = Tartarus::ArchivableItem.new
  yield item
  item.validate!

  registry.register(item)
end

#scheduleObject



46
47
48
# File 'lib/tartarus.rb', line 46

def schedule
  registry.each { |item| repository.save(item) }
end