Class: AWS::SimpleDB::DomainMetadata

Inherits:
Object
  • Object
show all
Includes:
Core::Model
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
}

Constant Summary collapse

ATTRIBUTES =
[
  :item_count,
  :item_names_size_bytes,
  :attribute_name_count,
  :attribute_names_size_bytes,
  :attribute_value_count,
  :attribute_values_size_bytes,
  :timestamp,
]

Instance Attribute Summary collapse

Attributes included from Core::Model

#config

Instance Method Summary collapse

Methods included from Core::Model

#client, #config_prefix, #inspect

Constructor Details

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

Parameters:

  • domain (Domain)

    The domain to fetch metadata for.



53
54
55
56
# File 'lib/aws/simple_db/domain_metadata.rb', line 53

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.



59
60
61
# File 'lib/aws/simple_db/domain_metadata.rb', line 59

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.



74
75
76
# File 'lib/aws/simple_db/domain_metadata.rb', line 74

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.



80
81
82
# File 'lib/aws/simple_db/domain_metadata.rb', line 80

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.



86
87
88
# File 'lib/aws/simple_db/domain_metadata.rb', line 86

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.



91
92
93
# File 'lib/aws/simple_db/domain_metadata.rb', line 91

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.



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

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.



68
69
70
# File 'lib/aws/simple_db/domain_metadata.rb', line 68

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.



97
98
99
# File 'lib/aws/simple_db/domain_metadata.rb', line 97

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.



103
104
105
106
# File 'lib/aws/simple_db/domain_metadata.rb', line 103

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