Class: Martilla::Local
- Defined in:
- lib/martilla/storages/local.rb
Instance Attribute Summary
Attributes inherited from Storage
Instance Method Summary collapse
Methods inherited from Storage
#append_datetime_suffix, #config_error, create, #enforce_retention!, #initialize, #invalid_options_msg, #options_filename, #output_filename, #retention_limit, #suffix?, #timestamp_regex
Methods inherited from Component
Constructor Details
This class inherits a constructor from Martilla::Storage
Instance Method Details
#enfore_retention!(gzip:) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/martilla/storages/local.rb', line 9 def enfore_retention!(gzip:) return if retention_limit < 1 files = backup_file_list(output_filename(gzip)) while files.count > retention_limit do File.delete(files.first) puts "Retention limit met. Removed the backup file: #{files.shift}" end end |
#persist(tmp_file:, gzip:) ⇒ Object
3 4 5 6 7 |
# File 'lib/martilla/storages/local.rb', line 3 def persist(tmp_file:, gzip:) bash("mv #{tmp_file} #{output_filename(gzip)}") return nil if $?.success? raise Error.new("Local storage failed with code #{$?.exitstatus}") end |