Class: Dizby::AbstractServer

Inherits:
Object
  • Object
show all
Extended by:
Configurable
Defined in:
lib/dizby/server/abstract.rb

Direct Known Subclasses

BasicServer, DeadProtocol::Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Configurable

config_accessor, config_reader, config_writer

Constructor Details

#initialize(config, &log_transform) ⇒ AbstractServer

Returns a new instance of AbstractServer.


13
14
15
16
# File 'lib/dizby/server/abstract.rb', line 13

def initialize(config, &log_transform)
  @config = config
  @log = Dizby.create_logger(config[:log] || {}, &log_transform)
end

Instance Attribute Details

#log (readonly)

Returns the value of attribute log


18
19
20
# File 'lib/dizby/server/abstract.rb', line 18

def log
  @log
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)

31
32
33
# File 'lib/dizby/server/abstract.rb', line 31

def alive?
  true
end

#connect_to(uri)


21
22
23
# File 'lib/dizby/server/abstract.rb', line 21

def connect_to(uri)
  ProtocolManager.open_client(self, uri)
end

#make_distributed(obj, error)


35
36
37
38
39
40
41
42
# File 'lib/dizby/server/abstract.rb', line 35

def make_distributed(obj, error)
  if error
    RemoteDistributedError.new(obj)
  else
    log.debug("making distributed: #{obj.inspect}")
    DistributedObject.new(obj, self)
  end
end

#shutdown


29
# File 'lib/dizby/server/abstract.rb', line 29

def shutdown; end

#spawn_on(command, uri)


25
26
27
# File 'lib/dizby/server/abstract.rb', line 25

def spawn_on(command, uri)
  ProtocolManager.spawn_server(self, command, uri)
end