Wraps a DRb message-result after consuming it from a stream.
Creates a new MessageResult for the
creating drbdump
instance. The last packet in the message is
packet
and the Marshal::Structure for the result type is
status
. The rest of the message will be loaded from
stream
.
# File lib/drbdump/message_result.rb, line 12 def initialize drbdump, packet, status, stream super drbdump, packet @result = nil @status = nil @stream = stream @raw_result = @loader.load stream @raw_status = status end
The number of allocations required to load the result.
# File lib/drbdump/message_result.rb, line 26 def allocations @raw_status.count_allocations + @raw_result.count_allocations end
Prints the message information to standard output
# File lib/drbdump/message_result.rb, line 33 def display update_statistics return if @drbdump.quiet message = status ? 'success' : 'exception' arrow = status ? "\u21d0" : "\u2902" timestamp = self.timestamp.strftime DRbDump::TIMESTAMP_FORMAT puts "%s %s %s %s %s: %s" % [ timestamp, destination, arrow, source, message, result ] end
The loaded result object
# File lib/drbdump/message_result.rb, line 50 def result return @result if @result result = @drbdump.load_marshal_data @raw_result @result = if DRb::DRbObject === result then "(\"druby://#{result.__drburi}\", #{result.__drbref})" else result.inspect end end
The loaded status object
# File lib/drbdump/message_result.rb, line 65 def status @status ||= @raw_status.load end
The timestamp of the last packet in the result
# File lib/drbdump/message_result.rb, line 72 def timestamp @packet.timestamp end