Method: SlidayBackup::CloudIO::CloudFiles#delete

Defined in:
lib/sliday_backup/cloud_io/cloud_files.rb

#delete(objects_or_names) ⇒ Object

Delete non-SLO object(s) from the container.

  • Called by the Storage (with objects) and the Syncer (with names)

  • Deletes 10,000 objects per request.

  • Missing objects will be ignored.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/sliday_backup/cloud_io/cloud_files.rb', line 104

def delete(objects_or_names)
  names = Array(objects_or_names).dup
  names.map!(&:name) if names.first.is_a?(Object)

  until names.empty?
    _names = names.slice!(0, 10000)
    with_retries('DELETE Multiple Objects') do
      resp = connection.delete_multiple_objects(container, _names)
      resp_status = resp.body['Response Status']
      raise Error, <<-EOS unless resp_status == '200 OK'
        #{ resp_status }
        The server returned the following:
        #{ resp.body.inspect }
      EOS
    end
  end
end