module RSence

The RSence module contains the server interfaces of RSence.

The classes that matter from a Plugin developer’s point of view are:

Most other classes are inner workings of RSence itself and are subject to change without further notice.

Constants

SessionBackend

MongoSessionStorage is the SessionStorage backend for MongoDB Authentication string format is strictly like this for now:

mongodb://username:password@host:port/database

Public Class Methods

args() click to toggle source

Command line options parsed @return [Hash] Parsed command-line options:

Key (Symbol)

Value

:env_path

(String) The directory of the environment.

:conf_files

(Array of Strings) Additional configuration files given with the --conf command-line option. Default is [].

:debug

(true or false) True, if the -d or --debug command-line option was given. Default is false.

:verbose

(true or false) True, if the -v or --verbose command-line option was given. Default is false.

:log_fg

(true or false) True, if the -f or --log-fg command-line option was given. Default is false.

:trace_js

(true or false) True, if the --trace-js command-line option was given. Default is false.

:trace_delegate

(true or false) True, if the --trace-delegate command-line option was given. Default is false.

:port

(String or nil) The TCP port number given with the --port command-line option. Default is nil.

:addr

(String or nil) The TCP bind address given with the --addr command-line option. Default is nil.

:server

(String or nil) The Rack http server handler given with the --server command-line option. Default is nil.

:reset_ses

(true or false) True, if the -r or --reset-sessions command-line option was given. Default is false.

:autoupdate

(true or false) True, if the -a or --auto-update command-line option was given. Default is false.

:latency

(Number) Amount of milliseconds to sleep in each request given with the --latency command-line option. Default is 0.

:say

(true or false) True, if the -S or --say command-line option was given. Default is false.

# File lib/rsence.rb, line 70
def self.args; @@argv_parser.args; end
argv() click to toggle source

@private This accessor enables RSence.argv method, which returns the ARGVParser instance

# File lib/rsence.rb, line 48
def self.argv;    @@argv_parser;    end
cmd() click to toggle source

@private This accessor enables RSence.cmd method, which returns the command the process was started with.

# File lib/rsence.rb, line 51
def self.cmd;     @@argv_parser.cmd;     end
config() click to toggle source

RSence runtime configuration data @return [Hash] the active configuration structure as defined by the {file:default_conf default configuration} and overridden by local configuration files.

# File lib/rsence.rb, line 89
def self.config
  @@config
end
darwin?() click to toggle source

@private Returns true, if platform is Mac OS X

# File lib/rsence.rb, line 34
def self.darwin?
  return RUBY_PLATFORM.include?('-darwin')
end
env_path() click to toggle source
# File lib/rsence.rb, line 72
def self.env_path; @@argv_parser.args[:env_path]; end
info_signal_name() click to toggle source

@private Returns signal name that resembles INFO or PWR (extra signal to poll for server status)

# File lib/rsence.rb, line 39
def self.info_signal_name
  if self.linux?
    return 'PWR'
  else
    return 'INFO'
  end
end
launch_pid() click to toggle source

@private Returns the pid of the process when starting up.

PID is different for the forked child process or processes
# File lib/rsence/daemon.rb, line 19
def self.launch_pid
  return @@launch_pid
end
linux?() click to toggle source

@private Returns true, if platform is linux

# File lib/rsence.rb, line 29
def self.linux?
  return RUBY_PLATFORM.end_with?('-linux')
end
pid_support?() click to toggle source

@private Returns true, if platform fully supports POSIX standard signals.

# File lib/rsence.rb, line 23
def self.pid_support?
  # true for non-windows
  return (not ['i386-mingw32','x86-mingw32'].include?(RUBY_PLATFORM))
end
plugin_manager() click to toggle source
# File lib/rsence.rb, line 106
def self.plugin_manager
  return nil unless class_variable_defined?(:'@@plugin_manager')
  @@plugin_manager
end
plugin_manager=(plugin_manager) click to toggle source
# File lib/rsence.rb, line 110
def self.plugin_manager=(plugin_manager)
  if class_variable_defined?(:'@@plugin_manager')
    warn "WARN: @@plugin_manager already set."
    return
  else
    @@plugin_manager = plugin_manager
  end
end
session_manager() click to toggle source
# File lib/rsence.rb, line 132
def self.session_manager
  return nil unless class_variable_defined?(:'@@session_manager')
  @@session_manager
end
session_manager=(session_manager) click to toggle source
# File lib/rsence.rb, line 136
def self.session_manager=(session_manager)
  if class_variable_defined?(:'@@session_manager')
    warn "WARN: @@session_manager already set."
    return
  else
    @@session_manager = session_manager
  end
end
startable?() click to toggle source

@private This accessor enables RSence.startable? method, which returns true if a start-type command was given.

# File lib/rsence.rb, line 75
def self.startable?; @@argv_parser.startable?; end
startup() click to toggle source

@private This accessor enables RSence.startup method, which starts RSence.

# File lib/rsence.rb, line 81
def self.startup
  puts "Loading configuration..." if self.args[:verbose]
  # Use the default configuration:
  require 'rsence/default_config'
  @@config = Configuration.new(self.args).config
  
  # RSence runtime configuration data
  # @return [Hash] the active configuration structure as defined by the {file:default_conf default configuration} and overridden by local configuration files.
  def self.config
    @@config
  end
  
  def self.transporter
    return nil unless class_variable_defined?(:'@@transporter')
    @@transporter
  end
  def self.transporter=(transporter)
    if class_variable_defined?(:'@@transporter')
      warn "WARN: Transporter already set."
      return
    else
      @@transporter = transporter
    end
  end
  
  def self.plugin_manager
    return nil unless class_variable_defined?(:'@@plugin_manager')
    @@plugin_manager
  end
  def self.plugin_manager=(plugin_manager)
    if class_variable_defined?(:'@@plugin_manager')
      warn "WARN: @@plugin_manager already set."
      return
    else
      @@plugin_manager = plugin_manager
    end
  end
  
  def self.value_manager
    return nil unless class_variable_defined?(:'@@value_manager')
    @@value_manager
  end
  def self.value_manager=(value_manager)
    if class_variable_defined?(:'@@value_manager')
      warn "WARN: @@value_manager already set."
      return
    else
      @@value_manager = value_manager
    end
  end
  
  def self.session_manager
    return nil unless class_variable_defined?(:'@@session_manager')
    @@session_manager
  end
  def self.session_manager=(session_manager)
    if class_variable_defined?(:'@@session_manager')
      warn "WARN: @@session_manager already set."
      return
    else
      @@session_manager = session_manager
    end
  end
  
  ## Riassence Daemon controls
  require 'rsence/daemon'
  puts "Starting RSence..." if self.args[:verbose]
  daemon = HTTPDaemon.new
  daemon.daemonize!
end
transporter() click to toggle source
# File lib/rsence.rb, line 93
def self.transporter
  return nil unless class_variable_defined?(:'@@transporter')
  @@transporter
end
transporter=(transporter) click to toggle source
# File lib/rsence.rb, line 97
def self.transporter=(transporter)
  if class_variable_defined?(:'@@transporter')
    warn "WARN: Transporter already set."
    return
  else
    @@transporter = transporter
  end
end
value_manager() click to toggle source
# File lib/rsence.rb, line 119
def self.value_manager
  return nil unless class_variable_defined?(:'@@value_manager')
  @@value_manager
end
value_manager=(value_manager) click to toggle source
# File lib/rsence.rb, line 123
def self.value_manager=(value_manager)
  if class_variable_defined?(:'@@value_manager')
    warn "WARN: @@value_manager already set."
    return
  else
    @@value_manager = value_manager
  end
end
version() click to toggle source

@return [String] The version of RSence

# File lib/rsence.rb, line 78
def self.version; @@argv_parser.version; end