Class: AWS::SimpleDB::DomainMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/simple_db/domain_metadata.rb

Overview

SimpleDB can report on the amount of data stored in a domain, the number of items, etc.

Examples:


sdb = SimpleDB.new
sdb.domains['mydomain']..to_h

# the hash returned above might look like:
{
  :timestamp => 1300841880,
  :attribute_names_size_bytes => 12,
  :item_count => 1,
  :attribute_value_count => 6,
  :attribute_values_size_bytes => 25,
  :item_names_size_bytes => 3,
  :attribute_name_count => 3
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain, options = {}) ⇒ DomainMetadata

Parameters:

  • The (Domain)

    domain to fetch metadata for.



55
56
57
58
# File 'lib/aws/simple_db/domain_metadata.rb', line 55

def initialize domain, options = {}
  @domain = domain
  super
end

Instance Attribute Details

#domainDomain (readonly)

Returns The domain this metadata is describing.

Returns:

  • (Domain)

    The domain this metadata is describing.



61
62
63
# File 'lib/aws/simple_db/domain_metadata.rb', line 61

def domain
  @domain
end

Instance Method Details

#attribute_name_countInteger

Returns The number of unique attribute names in the #domain.

Returns:

  • (Integer)

    The number of unique attribute names in the #domain.



76
77
78
# File 'lib/aws/simple_db/domain_metadata.rb', line 76

def attribute_name_count
  self.to_h[:attribute_name_count]
end

#attribute_names_size_bytesInteger

Returns The total size of all unique attribute names, in bytes.

Returns:

  • (Integer)

    The total size of all unique attribute names, in bytes.



82
83
84
# File 'lib/aws/simple_db/domain_metadata.rb', line 82

def attribute_names_size_bytes
  self.to_h[:attribute_names_size_bytes]
end

#attribute_value_countInteger

Returns The number of all attribute name/value pairs in the #domain.

Returns:

  • (Integer)

    The number of all attribute name/value pairs in the #domain.



88
89
90
# File 'lib/aws/simple_db/domain_metadata.rb', line 88

def attribute_value_count
  self.to_h[:attribute_value_count]
end

#attribute_values_size_bytesInteger

Returns The total size of all attribute values, in bytes.

Returns:

  • (Integer)

    The total size of all attribute values, in bytes.



93
94
95
# File 'lib/aws/simple_db/domain_metadata.rb', line 93

def attribute_values_size_bytes
  self.to_h[:attribute_values_size_bytes]
end

#item_countInteger

Returns The number of all items in the #domain.

Returns:

  • (Integer)

    The number of all items in the #domain.



64
65
66
# File 'lib/aws/simple_db/domain_metadata.rb', line 64

def item_count
  self.to_h[:item_count]
end

#item_names_size_bytesInteger

Returns The total size of all item names in the #domain, in bytes.

Returns:

  • (Integer)

    The total size of all item names in the #domain, in bytes.



70
71
72
# File 'lib/aws/simple_db/domain_metadata.rb', line 70

def item_names_size_bytes
  self.to_h[:item_names_size_bytes]
end

#timestampInteger

Returns The data and time when metadata was calculated in Epoch (UNIX) time.

Returns:

  • (Integer)

    The data and time when metadata was calculated in Epoch (UNIX) time.



99
100
101
# File 'lib/aws/simple_db/domain_metadata.rb', line 99

def timestamp
  self.to_h[:timestamp]
end

#to_hHash

Returns A hash of all of the metadata attributes for this #domain.

Returns:

  • (Hash)

    A hash of all of the metadata attributes for this #domain.



105
106
107
108
# File 'lib/aws/simple_db/domain_metadata.rb', line 105

def to_h
  meta = client.(:domain_name => domain.name)
  ATTRIBUTES.inject({}) {|h,attr| h[attr] = meta.send(attr); h }
end