class Bones::RPC::Protocol::Acknowledge

Public Class Methods

deserialize(buffer, adapter = nil) click to toggle source
Calls superclass method
# File lib/bones/rpc/protocol/acknowledge.rb, line 55
def self.deserialize(buffer, adapter = nil)
  message = super
  message.deserialize_id(buffer)
  message.deserialize_ready(buffer)
  message
end
new(id, ready) click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 12
def initialize(id, ready)
  self.id = id
  self.ready = ready
end
unpack(data) click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 62
def self.unpack(data)
  buffer = StringIO.new(data)
  id, = buffer.read(4).unpack('N')
  ready = buffer.read(1)
  new(id, ready)
end

Public Instance Methods

ext_head() click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 22
def ext_head
  1
end
get(node) click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 69
def get(node)
  node.detach(:synack, id)
end
log_inspect() click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 45
def log_inspect
  type = "ACKNOWLEDGE"
  fields = []
  fields << ["%-12s", type]
  fields << ["id=%s", id]
  fields << ["ready=%s", ready]
  f, v = fields.transpose
  f.join(" ") % v
end
ready() click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 26
def ready
  @ready
end
ready=(val) click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 30
def ready=(val)
  @ready = case val
  when 0xC2
    false
  when 0xC3
    true
  else
    !!val
  end
end
serialize_ready(buffer) click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 41
def serialize_ready(buffer)
  buffer << [ready ? 0xC3 : 0xC2].pack('C')
end
signal(future) click to toggle source
# File lib/bones/rpc/protocol/acknowledge.rb, line 73
def signal(future)
  future.signal(FutureValue.new(self))
end