Wraps a DRb message-send after consuming it from a stream.
The number of arguments, not including the block
The arguments, each as a Marshal::Structure
The block as a Marshal::Structure
The message sent as a Marshal::Structure
Creates a new MessageSend for the creating
drbdump
instance. The last packet in the message is
packet
and the Marshal::Structure for the first argument is
receiver
. The rest of the message will be loaded from
stream
.
# File lib/drbdump/message_send.rb, line 32 def initialize drbdump, packet, receiver, stream super drbdump, packet @argc = nil @argv = nil @block = nil @message = nil @raw_receiver = receiver @stream = stream load_message if stream end
The number of allocations required to load the message.
# File lib/drbdump/message_send.rb, line 48 def allocations allocations = 0 allocations += @raw_receiver.count_allocations allocations += @raw_message.count_allocations @raw_argv.each { |arg| allocations += arg.count_allocations } allocations += @raw_block.count_allocations allocations end
Number of arguments including the block
# File lib/drbdump/message_send.rb, line 71 def argument_count @argc + (block ? 1 : 0) end
A string containing all loaded arguments including the block.
# File lib/drbdump/message_send.rb, line 62 def arguments arguments = argv.map { |obj| obj.inspect } (arguments << '&block') if block arguments.join ', ' end
The loaded arguments
# File lib/drbdump/message_send.rb, line 78 def argv @argv ||= @raw_argv.map { |obj| @drbdump.load_marshal_data obj } end
The loaded block
# File lib/drbdump/message_send.rb, line 85 def block @block ||= @raw_block.load end
Prints the message information to standard output
# File lib/drbdump/message_send.rb, line 92 def display update_statistics return if @drbdump.quiet timestamp = self.timestamp.strftime DRbDump::TIMESTAMP_FORMAT puts "%s %s \u21d2 (%s, %p).%s(%s)" % [ timestamp, source, destination, receiver, message, arguments ] end
The loaded message
# File lib/drbdump/message_send.rb, line 118 def message @message ||= @raw_message.load end
The loaded receiver for the message
# File lib/drbdump/message_send.rb, line 125 def receiver @receiver ||= @raw_receiver.load end
Returns the timestamp for the first packet in the incomplete stream for
packet
or the packet's timestamp if this is the only
packet in the stream.
# File lib/drbdump/message_send.rb, line 134 def timestamp @drbdump.incomplete_timestamps.delete(@packet.source) || @packet.timestamp end