class Bones::RPC::Protocol::Synchronize

Public Class Methods

deserialize(buffer, adapter = nil) click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 47
def self.deserialize(buffer, adapter = nil)
  message = super
  message.deserialize_id(buffer)
  message.deserialize_adapter(buffer)
  message
end
new(id, adapter) click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 12
def initialize(id, adapter)
  self.id = id
  self.adapter = adapter
end
unpack(data) click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 54
def self.unpack(data)
  buffer = StringIO.new(data)
  id, = buffer.read(4).unpack('N')
  adapter = buffer.read
  new(id, adapter)
end

Public Instance Methods

adapter=(adapter) click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 25
def adapter=(adapter)
  @adapter = Adapter.get(adapter)
end
attach(node, future) click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 61
def attach(node, future)
  node.attach(:synack, id, future)
end
deserialize_adapter(buffer) click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 29
def deserialize_adapter(buffer)
  self.adapter = buffer.read(ext_length - 5)
end
ext_head() click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 21
def ext_head
  0
end
log_inspect() click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 37
def log_inspect
  type = "SYNCHRONIZE"
  fields = []
  fields << ["%-12s", type]
  fields << ["id=%s", id]
  fields << ["adapter=%s", adapter]
  f, v = fields.transpose
  f.join(" ") % v
end
serialize_adapter(buffer) click to toggle source
# File lib/bones/rpc/protocol/synchronize.rb, line 33
def serialize_adapter(buffer)
  buffer << adapter.adapter_name.to_s
end