Method: SlidayBackup::CloudIO::CloudFiles#objects

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

#objects(prefix) ⇒ Object

Returns all objects in the container with the given prefix.

  • #get_container returns a max of 10000 objects per request.

  • Returns objects sorted using a sqlite binary collating function.

  • If marker is given, only objects after the marker are in the response.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/sliday_backup/cloud_io/cloud_files.rb', line 69

def objects(prefix)
  objects = []
  resp = nil
  prefix = prefix.chomp('/')
  opts = { :prefix => prefix + '/' }

  create_containers

  while resp.nil? || resp.body.count == 10000
    opts.merge!(:marker => objects.last.name) unless objects.empty?
    with_retries("GET '#{ container }/#{ prefix }/*'") do
      resp = connection.get_container(container, opts)
    end
    resp.body.each do |obj_data|
      objects << Object.new(self, obj_data)
    end
  end

  objects
end