Class: RightScale::Stats
Overview
Packet for carrying statistics
Constant Summary
Constants inherited from Packet
Packet::DEFAULT_VERSION, Packet::GLOBAL, Packet::NOT_SERIALIZED, Packet::PACKET_SIZE_REGEXP, Packet::VERSION
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#from ⇒ Object
Returns the value of attribute from.
-
#token ⇒ Object
Returns the value of attribute token.
Attributes inherited from Packet
Class Method Summary collapse
-
.create(o) ⇒ Object
Create packet from unmarshalled data.
Instance Method Summary collapse
-
#initialize(data, from, version = [VERSION, VERSION], size = nil) ⇒ Stats
constructor
Create packet.
-
#to_s(filter = nil, version = nil) ⇒ Object
Generate log representation.
Methods inherited from Packet
compatible, #enough_precision, #id_to_s, #ids_to_s, json_create, msgpack_create, #name, #one_way, #recv_version, #send_version, #send_version=, #target_for_encryption, #to_json, #to_msgpack, #trace
Constructor Details
#initialize(data, from, version = [VERSION, VERSION], size = nil) ⇒ Stats
Create packet
Parameters
- data(Object)
-
Data
- from(String)
-
Identity of sender
- version(Array)
-
Protocol version of the original creator of the packet followed by the
protocol version of the packet contents to be used when sending
- size(Integer)
-
Size of request in bytes used only for marshalling
646 647 648 649 650 651 |
# File 'lib/right_agent/packets.rb', line 646 def initialize(data, from, version = [VERSION, VERSION], size = nil) @data = data @from = from @version = version @size = size end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
636 637 638 |
# File 'lib/right_agent/packets.rb', line 636 def data @data end |
#from ⇒ Object
Returns the value of attribute from.
636 637 638 |
# File 'lib/right_agent/packets.rb', line 636 def from @from end |
#token ⇒ Object
Returns the value of attribute token.
636 637 638 |
# File 'lib/right_agent/packets.rb', line 636 def token @token end |
Class Method Details
.create(o) ⇒ Object
Create packet from unmarshalled data
Parameters
- o(Hash)
-
Unmarshalled data
Return
- (Result)
-
New packet
660 661 662 663 |
# File 'lib/right_agent/packets.rb', line 660 def self.create(o) i = o['data'] new(i['data'], self.compatible(i['from']), i['version'] || [DEFAULT_VERSION, DEFAULT_VERSION], o['size']) end |
Instance Method Details
#to_s(filter = nil, version = nil) ⇒ Object
Generate log representation
Parameters
- filter(Array(Symbol))
-
Attributes to be included in output
- version(Symbol|nil)
-
Version to display: :recv_version, :send_version, or nil meaning none
Return
- log_msg(String)
-
Log representation
673 674 675 |
# File 'lib/right_agent/packets.rb', line 673 def to_s(filter = nil, version = nil) log_msg = "#{super(filter, version)} #{id_to_s(@from)}" end |