class Bones::RPC::Node::Registry
Public Class Methods
new()
click to toggle source
# File lib/bones/rpc/node/registry.rb, line 7 def initialize @registry = {} end
Public Instance Methods
empty?()
click to toggle source
# File lib/bones/rpc/node/registry.rb, line 11 def empty? @registry.empty? || @registry.all? { |channel, child| child.empty? } end
flush(exception = Errors::ConnectionFailure.new("Socket closed"))
click to toggle source
# File lib/bones/rpc/node/registry.rb, line 15 def flush(exception = Errors::ConnectionFailure.new("Socket closed")) return true if @registry.empty? @registry.each do |channel, futures| futures.each do |id, future| future.signal(FutureValue.new(exception)) rescue nil end end @registry.clear end
get(channel, id)
click to toggle source
# File lib/bones/rpc/node/registry.rb, line 25 def get(channel, id) (@registry[channel] ||= {}).delete(id) end
set(channel, id, future)
click to toggle source
# File lib/bones/rpc/node/registry.rb, line 29 def set(channel, id, future) (@registry[channel] ||= {})[id] = future end