Module: RGossip

Defined in:
lib/rgossip.rb,
lib/rgossip/node.rb,
lib/rgossip/nodes.rb,
lib/rgossip/timer.rb,
lib/rgossip/client.rb,
lib/rgossip/receiver.rb,
lib/rgossip/gossipper.rb

Defined Under Namespace

Classes: Client, Gossiper, Node, Nodes, Receiver, Timer

Constant Summary collapse

DEFAULT_LOGGER =
Logger.new($stderr)
@@port =
10870
@@bufsiz =
512
@@allowance =
3
@@error_handler =
lambda do |e|
  message = (["#{e.class}: #{e.message}"] + (e.backtrace || [])).join("\n\tfrom ")
   if self.debug_logger
    self.debug_logger.call(message)
  else
    $stderr.puts(message)
  end
end
@@debug =
false
@@debug_logger =
lambda {|message| DEFAULT_LOGGER.debug(message) }

Class Method Summary collapse

Class Method Details

.allowanceObject



25
# File 'lib/rgossip.rb', line 25

def self.allowance; @@allowance; end

.allowance=(v) ⇒ Object



26
# File 'lib/rgossip.rb', line 26

def self.allowance=(v); @@allowance = v; end

.bufsizObject



21
# File 'lib/rgossip.rb', line 21

def self.bufsiz; @@bufsiz; end

.bufsiz=(v) ⇒ Object



22
# File 'lib/rgossip.rb', line 22

def self.bufsiz=(v); @@bufsiz = v; end

.debugObject



42
# File 'lib/rgossip.rb', line 42

def self.debug; @@debug; end

.debug=(v) ⇒ Object



43
# File 'lib/rgossip.rb', line 43

def self.debug=(v); @@debug = v; end

.debug_loggerObject



46
# File 'lib/rgossip.rb', line 46

def self.debug_logger; @@debug_logger; end

.debug_logger=(v) ⇒ Object



47
# File 'lib/rgossip.rb', line 47

def self.debug_logger=(v); @@debug_logger = v; end

.error_handlerObject



38
# File 'lib/rgossip.rb', line 38

def self.error_handler; @@error_handler; end

.error_handler=(v) ⇒ Object



39
# File 'lib/rgossip.rb', line 39

def self.error_handler=(v); @@error_handler = v; end

.log(message) ⇒ Object



49
50
51
52
53
# File 'lib/rgossip.rb', line 49

def self.log(message)
  if self.debug
    self.debug_logger.call(message)
  end
end

.portObject



17
# File 'lib/rgossip.rb', line 17

def self.port; @@port; end

.port=(v) ⇒ Object



18
# File 'lib/rgossip.rb', line 18

def self.port=(v); @@port = v; end