class Floss::Peer
A peer is a remote node within the same cluster.
Attributes
client[RW]
@return [Floss::RPC::Client]
id[RW]
@return [String] Remote address of the peer.
Public Class Methods
new(id, opts = {})
click to toggle source
# File lib/floss/peer.rb, line 14 def initialize(id, opts = {}) self.id = id client_class = opts[:rpc_client_class] || Floss::RPC::ZMQ::Client self.client = client_class.new(id) end
Public Instance Methods
append_entries(payload)
click to toggle source
# File lib/floss/peer.rb, line 25 def append_entries(payload) client.call(:append_entries, payload) end
execute(payload)
click to toggle source
# File lib/floss/peer.rb, line 21 def execute(payload) client.call(:execute, payload) end
request_vote(payload)
click to toggle source
# File lib/floss/peer.rb, line 29 def request_vote(payload) client.call(:vote_request, payload) end