Method: OpenStack::Swift::Connection#get_info

Defined in:
lib/openstack/swift/connection.rb

#get_infoObject

Sets instance variables for the bytes of storage used for this account/connection, as well as the number of containers stored under the account. Returns a hash with :bytes and :count keys, and also sets the instance variables.

cf.get_info
=> {:count=>8, :bytes=>42438527}
cf.bytes
=> 42438527

Hostname of the storage server



46
47
48
49
50
51
52
# File 'lib/openstack/swift/connection.rb', line 46

def get_info
    raise OpenStack::Exception::Authentication, "Not authenticated" unless authok?
    response = @connection.req("HEAD", "")
    @bytes = response["x-account-bytes-used"].to_i
    @count = response["x-account-container-count"].to_i
    {:bytes => @bytes, :count => @count}
end