class RIMS::Service::Configuration

Constants

KeyValueStoreFactoryBuilderParams

Public Class Methods

get_configuration(collection, base_dir=nil) click to toggle source
# File lib/rims/service.rb, line 52
def get_configuration(collection, base_dir=nil)
  if ((collection.key? 'configuration') && (collection.key? 'configuration_file')) then
    raise KeyError, 'configuration conflict: configuration, configuraion_file'
  end

  if (collection.key? 'configuration') then
    collection['configuration']
  elsif (collection.key? 'configuration_file') then
    configuration_file_path = Pathname(collection['configuration_file'])
    if (configuration_file_path.relative?) then
      base_dir or raise ArgumentError, 'need for base_dir.'
      configuration_file_path = base_dir + configuration_file_path # expect base_dir to be Pathname
    end
    YAML.load_file(configuration_file_path.to_s)
  else
    {}
  end
end
new() click to toggle source
# File lib/rims/service.rb, line 72
def initialize
  @config = {}
end
stringify_symbol(collection) click to toggle source
# File lib/rims/service.rb, line 15
def stringify_symbol(collection)
  case (collection)
  when Hash
    Hash[collection.map{|key, value| [ stringify_symbol(key), stringify_symbol(value) ] }]
  when Array
    collection.map{|i| stringify_symbol(i) }
  else
    case (value = collection)
    when Symbol
      value.to_s
    else
      value
    end
  end
end
update(dest, other) click to toggle source
# File lib/rims/service.rb, line 31
def update(dest, other)
  case (dest)
  when Hash
    unless (other.is_a? Hash) then
      raise ArgumentError, 'hash can only be updated with hash.'
    end
    for key, value in other
      dest[key] = update(dest[key], value)
    end
    dest
  when Array
    if (other.is_a? Array) then
      dest.concat(other)
    else
      other
    end
  else
    other
  end
end

Public Instance Methods

accept_polling_timeout_seconds() click to toggle source
# File lib/rims/service.rb, line 481
def accept_polling_timeout_seconds
  @config.dig('server', 'accept_polling_timeout_seconds') || 0.1
end
base_dir() click to toggle source
# File lib/rims/service.rb, line 304
def base_dir
  @config['base_dir'] or raise KeyError, 'not defined base_dir.'
end
bulk_response_count() click to toggle source
# File lib/rims/service.rb, line 661
def bulk_response_count
  @config.dig('drb_services', 'engine', 'bulk_response_count') || 100
end
bulk_response_size() click to toggle source
# File lib/rims/service.rb, line 665
def bulk_response_size
  @config.dig('drb_services', 'engine', 'bulk_response_size') || 1024**2 * 10
end
charset_aliases() click to toggle source
# File lib/rims/service.rb, line 585
def charset_aliases
  charset_aliases = RFC822::CharsetAliases.new

  if (@config.dig('charset')&.key? 'use_default_aliases') then
    use_default_aliases = @config.dig('charset', 'use_default_aliases')
  else
    use_default_aliases = true
  end

  if (use_default_aliases) then
    for name, encoding in RFC822::DEFAULT_CHARSET_ALIASES
      charset_aliases.add_alias(name, encoding)
    end
  end

  if (alias_list = @config.dig('charset', 'aliases')) then
    for an_alias in alias_list
      charset_aliases.add_alias(an_alias['name'], Encoding.find(an_alias['encoding']))
    end
  end

  charset_aliases
end
charset_convert_options() click to toggle source
# File lib/rims/service.rb, line 609
def charset_convert_options
  options = {}

  if (@config.dig('charset', 'convert_options')&.key? 'replace_invalid_byte_sequence') then
    replace_invalid_byte_sequence = @config.dig('charset', 'convert_options', 'replace_invalid_byte_sequence')
  else
    replace_invalid_byte_sequence = false
  end

  if (replace_invalid_byte_sequence) then
    options[:invalid] = :replace
  end

  if (@config.dig('charset', 'convert_options')&.key? 'replace_undefined_character') then
    replace_undefined_character = @config.dig('charset', 'convert_options', 'replace_undefined_character')
  else
    replace_undefined_character = true
  end

  if (replace_undefined_character) then
    options[:undef] = :replace
  end

  if (replaced_mark = @config.dig('charset', 'convert_options', 'replaced_mark')) then
    options[:replace] = replaced_mark
  end

  options
end
cleanup_write_lock_timeout_seconds() click to toggle source
# File lib/rims/service.rb, line 681
def cleanup_write_lock_timeout_seconds
  @config.dig('drb_services', 'engine', 'cleanup_write_lock_timeout_seconds') ||
    @config.dig('cleanup_write_lock_timeout_seconds') || # for backward compatibility
    1
end
connection_limits() click to toggle source
# File lib/rims/service.rb, line 568
def connection_limits
  Protocol::ConnectionLimits.new(@config.dig('connection', 'read_polling_interval_seconds') || 1,
                                 @config.dig('connection', 'command_wait_timeout_seconds') || 60 * 30)
end
daemon_debug?() click to toggle source
# File lib/rims/service.rb, line 418
def daemon_debug?
  if (@config.dig('daemon')&.key? 'debug') then
    @config.dig('daemon', 'debug')
  else
    false
  end
end
daemon_name() click to toggle source
# File lib/rims/service.rb, line 414
def daemon_name
  'rims'
end
daemon_umask() click to toggle source
# File lib/rims/service.rb, line 426
def daemon_umask
  @config.dig('daemon', 'umask') || 0037
end
daemonize?() click to toggle source
# File lib/rims/service.rb, line 406
def daemonize?
  if (@config.dig('daemon')&.key? 'daemonize') then
    @config.dig('daemon', 'daemonize')
  else
    true
  end
end
drb_client_config() click to toggle source
# File lib/rims/service.rb, line 652
def drb_client_config
  config = {}
  if (load_limit = @config.dig('drb_services', 'load_limit')) then
    config[:load_limit] = load_limit
  end

  config
end
drb_process_num() click to toggle source
# File lib/rims/service.rb, line 639
def drb_process_num
  @config.dig('drb_services', 'process_num') || 0
end
drb_server_config() click to toggle source
# File lib/rims/service.rb, line 643
def drb_server_config
  config = {}
  if (load_limit = @config.dig('drb_services', 'load_limit')) then
    config[:load_limit] = load_limit
  end

  config
end
get_required_features() click to toggle source
# File lib/rims/service.rb, line 298
def get_required_features
  @config.dig('required_features') ||
    @config.dig('load_libraries') || # for backward compatibility
    []
end
listen_address() click to toggle source
# File lib/rims/service.rb, line 460
def listen_address
  if (socket_address = @config.dig('server', 'listen_address')) then
    return socket_address
  end

  # for backward compatibility
  host = @config.dig('imap_host') || @config.dig('ip_addr')
  port = @config.dig('imap_port') || @config.dig('ip_port')
  if (host || port) then
    socket_adress = {
      'type' => 'tcp',
      'host' => host || '0.0.0.0',
      'port' => port || 1430
    }
    return socket_adress
  end

  # default
  '0.0.0.0:1430'
end
load(config, load_path=nil) click to toggle source
# File lib/rims/service.rb, line 76
def load(config, load_path=nil)
  stringified_config = self.class.stringify_symbol(config)
  if (stringified_config.key? 'base_dir') then
    base_dir = Pathname(stringified_config['base_dir'])
    if (load_path && base_dir.relative?) then
      stringified_config['base_dir'] = Pathname(load_path) + base_dir
    else
      stringified_config['base_dir'] = base_dir
    end
  elsif (load_path) then
    stringified_config['base_dir'] = Pathname(load_path)
  end
  self.class.update(@config, stringified_config)

  self
end
load_yaml(path) click to toggle source

configuration example.

required_features:
  - rims/qdbm
  - rims/passwd/ldap
logging:
  file:
    path: rims.log
    shift_age: 10
    shift_size: 1048576
    level: debug
    datetime_format: %Y-%m-%d %H:%M:%S
    shift_period_suffix: %Y%m%d
  stdout:
    level: info
    datetime_format: %Y-%m-%d %H:%M:%S
  protocol:
    # default is not output.
    # to output, set the log level to info or less.
    path: protocol.log
    shift_age: 10
    shift_size: 1048576
    level: info
    datetime_format: %Y-%m-%d %H:%M:%S
    shift_period_suffix: %Y%m%d
daemon:
  daemonize: true
  debug: false
  umask: 0037
  status_file: rims.pid
  server_polling_interval_seconds: 3
  server_privileged_user: nobody
  server_privileged_group: nogroup
server:
  listen_address:
    # see `Riser::SocketAddress.parse' for address format
    type: tcp
    host: 0.0.0.0
    port: 143
    backlog: 64
  accept_polling_timeout_seconds: 0.1
  process_num: 4
  process_queue_size: 20
  process_queue_polling_timeout_seconds: 0.1
  process_send_io_polling_timeout_seconds: 0.1
  thread_num: 20
  thread_queue_size: 20
  thread_queue_polling_timeout_seconds: 0.1
openssl:
  use_ssl: true
  ssl_context: |
    # this entry is evaluated in an anonymous ruby ​​module
    # including OpenSSL to initialize the SSLContext used
    # for TLS connection.
    # SSLContext object is stored at `_'.
    # Pathname object is stored at `base_dir'.
    _.cert = X509::Certificate.new((base_dir / "tls_cert" / "server_default.cert").read)
    _.key = PKey.read((base_dir / "tls_secret" / "server.priv_key").read)
    sni_tbl = {
      "imap.example.com"  => SSLContext.new.tap{|c| c.key = _.key; c.cert = X509::Certificate.new((base_dir / "tls_cert" / "server_imap.cert").read) },
      "imap2.example.com" => SSLContext.new.tap{|c| c.key = _.key; c.cert = X509::Certificate.new((base_dir / "tls_cert" / "server_imap2.cert").read) },
      "imap3.example.com" => SSLContext.new.tap{|c| c.key = _.key; c.cert = X509::Certificate.new((base_dir / "tls_cert" / "server_imap3.cert").read) }
    }
    _.servername_cb = lambda{|ssl_socket, hostname| sni_tbl[hostname.downcase] }
connection:
  send_buffer_limit_size: 16384
  read_polling_interval_seconds: 1
  command_wait_timeout_seconds: 1800
protocol:
  line_length_limit: 8192
  literal_size_limit: 10485760
  command_size_limit: 10485760
charset:
  use_default_aliases: true
  aliases:
    - name: euc-jp
      encoding: eucJP-ms
    - name: ios-2022-jp
      encoding: CP50221
    - name: Shift_JIS
      encoding: Windows-31J
  convert_options:
    replace_invalid_byte_sequence: false
    replace_undefined_character: true
    replaced_mark: "\uFFFD"
drb_services:
  process_num: 4
  load_limit: 134217728
  engine:
    bulk_response_count: 100
    bulk_response_size: 33554432
    read_lock_timeout_seconds: 30
    write_lock_timeout_seconds: 30
    cleanup_write_lock_timeout_seconds: 1
storage:
  meta_key_value_store:
    type: qdbm_depot
    configuration:
      bnum 1200000
    use_checksum: true
  text_key_value_store:
    type: qdbm_curia
    configuration_file: text_kvs_config.yml
    use_checksum: true
authentication:
  hostname: imap.example.com
  password_sources:
    - type: plain
      configuration:
        - user: alice
          pass: open sesame
        - user: bob
          pass: Z1ON0101
    - type: hash
      configuration_file: passwd_hash.yml
    - type: ldap
      configuration:
        ldap_uri: ldap://ldap.example.com/ou=user,o=example,dc=nodomain?uid?one?(memberOf=cn=imap,ou=group,o=example,dc=nodomain)
authorization:
  mail_delivery_user: "#postman"

backward compatibility for required_features.

load_libraries:
  - rims/qdbm
  - rims/passwd/ldap

backward compatibility for logging.

log_file: rims.log
log_level: debug
log_shift_age: 10
log_shift_size: 1048576
log_stdout: info

backward compatibility for daemon.

process_privilege_user: nobody
process_privilege_group: nogroup

backward compatibility for server.

imap_host: 0.0.0.0
imap_port: 143
ip_addr: 0.0.0.0
ip_port: 143
send_buffer_limit: 16384

backward compatibility for lock.

read_lock_timeout_seconds: 30
write_lock_timeout_seconds: 30
cleanup_write_lock_timeout_seconds: 1

backward compatibility for storage.

key_value_store_type: gdbm
use_key_value_store_checksum: true
meta_key_value_store:
  plug_in: qdbm_depot
  configuration:
    bnum 1200000
  use_checksum: true
text_key_value_store:
  plug_in: qdbm_curia
  configuration_file: text_kvs_config.yml
  use_checksum: true

backward compatibility for authentication.

hostname: imap.example.com
username: alice
password: open sesame
user_list:
  - user: alice
    pass: open sesame
  - user: bob
    pass: Z1ON0101
authentication:
  - plug_in: plain
    configuration:
      - user: alice
        pass: open sesame
      - user: bob
        pass: Z1ON0101
  - plug_in: hash
    configuration_file: passwd_hash.yml
  - plug_in: ldap
    configuration:
      ldap_uri: ldap://ldap.example.com/ou=user,o=example,dc=nodomain?uid?one?(memberOf=cn=imap,ou=group,o=example,dc=nodomain)

backward compatibility for authorization.

mail_delivery_user: "#postman"
# File lib/rims/service.rb, line 279
def load_yaml(path)
  load(YAML.load_file(path), File.dirname(path))
  self
end
mail_delivery_user() click to toggle source
# File lib/rims/service.rb, line 802
def mail_delivery_user
  @config.dig('authorization', 'mail_delivery_user') ||
    @config.dig('mail_delivery_user') || # for backward compatibility
    '#postman'
end
make_authentication() click to toggle source
# File lib/rims/service.rb, line 748
def make_authentication
  if (@config.dig('authentication')&.is_a? Hash) then
    auth_conf = @config.dig('authentication')
  else
    auth_conf = {}
  end

  hostname = auth_conf['hostname'] ||
             @config['hostname'] || # for backward compatibility
             Socket.gethostname
  auth = Authentication.new(hostname: hostname)

  if (passwd_src_list = auth_conf['password_sources']) then
    for passwd_src_conf in passwd_src_list
      plug_in_name = passwd_src_conf['type'] or raise KeyError, 'not found a password source type.'
      plug_in_config = get_configuration(passwd_src_conf)
      passwd_src = Authentication.get_plug_in(plug_in_name, plug_in_config)
      auth.add_plug_in(passwd_src)
    end
  end

  # for backward compatibility
  if (user_list = @config['user_list']) then
    plain_src = Password::PlainSource.new
    for pw in user_list
      user = pw['user'] or raise KeyError, 'not found a user_list user.'
      pass = pw['pass'] or raise KeyError, 'not found a user_list pass.'
      plain_src.entry(user, pass)
    end
    auth.add_plug_in(plain_src)
  end

  # for backward compatibility
  if (username = @config['username']) then
    password = @config['password'] or raise KeyError, 'not found a password.'
    plain_src = Password::PlainSource.new
    plain_src.entry(username, password)
    auth.add_plug_in(plain_src)
  end

  # for backward compatibility
  if (@config.dig('authentication')&.is_a? Array) then
    plug_in_list = @config.dig('authentication')
    for plug_in_conf in plug_in_list
      plug_in_name = plug_in_conf['plug_in'] or raise KeyError, 'not found an authentication plug_in.'
      plug_in_config = get_configuration(plug_in_conf)
      passwd_src = Authentication.get_plug_in(plug_in_name, plug_in_config)
      auth.add_plug_in(passwd_src)
    end
  end

  auth
end
make_file_logger_params() click to toggle source

return parameters for Logger.new

# File lib/rims/service.rb, line 318
def make_file_logger_params
  log_path = Pathname(@config.dig('logging', 'file', 'path') ||
                      @config.dig('log_file') || # for backward compatibility
                      'rims.log')
  if (log_path.relative?) then
    if (@config.key? 'base_dir') then # to avoid an error with DEFAULT_CONFIG
      log_path = base_dir + log_path
    end
  end
  logger_params = [ log_path.to_s ]

  shift_age = @config.dig('logging', 'file', 'shift_age') ||
              @config.dig('log_shift_age') # for backward compatibility
  shift_size = @config.dig('logging', 'file', 'shift_size') ||
               @config.dig('log_shift_size') # for backward compatibility
  if (shift_size) then
    logger_params << (shift_age || 0)
    logger_params << shift_size
  elsif (shift_age) then
    logger_params << shift_age
  end

  kw_args = {}
  kw_args[:level] = @config.dig('logging', 'file', 'level') ||
                    @config.dig('log_level') || # for backward compatibility
                    'info'
  kw_args[:progname] = 'rims'
  if (datetime_format = @config.dig('logging', 'file', 'datetime_format')) then
    kw_args[:datetime_format] = datetime_format
  end
  if (shift_period_suffix = @config.dig('logging', 'file', 'shift_period_suffix')) then
    kw_args[:shift_period_suffix] = shift_period_suffix
  end
  logger_params << kw_args

  logger_params
end
make_key_value_store_path(mailbox_data_structure_version, unique_user_id) click to toggle source
# File lib/rims/service.rb, line 734
def make_key_value_store_path(mailbox_data_structure_version, unique_user_id)
  if (mailbox_data_structure_version.empty?) then
    raise ArgumentError, 'too short mailbox data structure version.'
  end
  if (unique_user_id.length <= 2) then
    raise ArgumentError, 'too short unique user ID.'
  end

  bucket_dir_name = unique_user_id[0..1]
  store_dir_name = unique_user_id[2..-1]

  base_dir + mailbox_data_structure_version + bucket_dir_name + store_dir_name
end
make_meta_key_value_store_params() click to toggle source
# File lib/rims/service.rb, line 722
def make_meta_key_value_store_params
  make_key_value_store_params(@config.dig('storage', 'meta_key_value_store') ||
                              @config.dig('meta_key_value_store') || # for backward compatibility
                              {})
end
make_protocol_logger_params() click to toggle source

return parameters for Logger.new

# File lib/rims/service.rb, line 374
def make_protocol_logger_params
  log_path = Pathname(@config.dig('logging', 'protocol', 'path') || 'protocol.log')
  if (log_path.relative?) then
    if (@config.key? 'base_dir') then # to avoid an error with DEFAULT_CONFIG
      log_path = base_dir + log_path
    end
  end
  logger_params = [ log_path.to_s ]

  shift_age = @config.dig('logging', 'protocol', 'shift_age')
  shift_size = @config.dig('logging', 'protocol', 'shift_size')
  if (shift_size) then
    logger_params << (shift_age || 0)
    logger_params << shift_size
  elsif (shift_age) then
    logger_params << shift_age
  end

  kw_args = {}
  kw_args[:level] = @config.dig('logging', 'protocol', 'level') || 'unknown'
  kw_args[:progname] = 'rims'
  if (datetime_format = @config.dig('logging', 'protocol', 'datetime_format')) then
    kw_args[:datetime_format] = datetime_format
  end
  if (shift_period_suffix = @config.dig('logging', 'protocol', 'shift_period_suffix')) then
    kw_args[:shift_period_suffix] = shift_period_suffix
  end
  logger_params << kw_args

  logger_params
end
make_stdout_logger_params() click to toggle source

return parameters for Logger.new

# File lib/rims/service.rb, line 357
def make_stdout_logger_params
  logger_params = [ STDOUT ]

  kw_args = {}
  kw_args[:level] = @config.dig('logging', 'stdout', 'level') ||
                    @config.dig('log_stdout') || # for backward compatibility
                    'info'
  kw_args[:progname] = 'rims'
  if (datetime_format = @config.dig('logging', 'stdout', 'datetime_format')) then
    kw_args[:datetime_format] = datetime_format
  end
  logger_params << kw_args

  logger_params
end
make_text_key_value_store_params() click to toggle source
# File lib/rims/service.rb, line 728
def make_text_key_value_store_params
  make_key_value_store_params(@config.dig('storage', 'text_key_value_store') ||
                              @config.dig('text_key_value_store') || # for backward compatibility
                              {})
end
process_num() click to toggle source
# File lib/rims/service.rb, line 485
def process_num
  @config.dig('server', 'process_num') || 0
end
process_queue_polling_timeout_seconds() click to toggle source
# File lib/rims/service.rb, line 493
def process_queue_polling_timeout_seconds
  @config.dig('server', 'process_queue_polling_timeout_seconds') || 0.1
end
process_queue_size() click to toggle source
# File lib/rims/service.rb, line 489
def process_queue_size
  @config.dig('server', 'process_queue_size') || 20
end
process_send_io_polling_timeout_seconds() click to toggle source
# File lib/rims/service.rb, line 497
def process_send_io_polling_timeout_seconds
  @config.dig('server', 'process_send_io_polling_timeout_seconds') || 0.1
end
protocol_command_size_limit() click to toggle source
# File lib/rims/service.rb, line 581
def protocol_command_size_limit
  @config.dig('protocol', 'command_size_limit') || 1024**2 * 10
end
protocol_line_length_limit() click to toggle source
# File lib/rims/service.rb, line 573
def protocol_line_length_limit
  @config.dig('protocol', 'line_length_limit') || 1024 * 8
end
protocol_literal_size_limit() click to toggle source
# File lib/rims/service.rb, line 577
def protocol_literal_size_limit
  @config.dig('protocol', 'literal_size_limit') || 1024**2 * 10
end
read_lock_timeout_seconds() click to toggle source
# File lib/rims/service.rb, line 669
def read_lock_timeout_seconds
  @config.dig('drb_services', 'engine', 'read_lock_timeout_seconds') ||
    @config.dig('read_lock_timeout_seconds') || # for backward compatibility
    30
end
require_features() click to toggle source
# File lib/rims/service.rb, line 284
def require_features
  # built-in plug-in
  require 'rims/gdbm_kvs'
  require 'rims/passwd'

  if (feature_list = get_required_features) then
    for feature in feature_list
      require(feature)
    end
  end

  nil
end
send_buffer_limit_size() click to toggle source
# File lib/rims/service.rb, line 562
def send_buffer_limit_size
  @config.dig('connection', 'send_buffer_limit_size') ||
    @config.dig('send_buffer_limit') || # for backward compatibility
    1024 * 16
end
server_polling_interval_seconds() click to toggle source
# File lib/rims/service.rb, line 441
def server_polling_interval_seconds
  @config.dig('daemon', 'server_polling_interval_seconds') || 3
end
server_privileged_group() click to toggle source
# File lib/rims/service.rb, line 455
def server_privileged_group
  @config.dig('daemon', 'server_privileged_group') ||
    @config.dig('process_privilege_group') # for backward compatibility
end
server_privileged_user() click to toggle source
# File lib/rims/service.rb, line 450
def server_privileged_user
  @config.dig('daemon', 'server_privileged_user') ||
    @config.dig('process_privilege_user') # for backward compatibility
end
server_restart_overlap_seconds() click to toggle source
# File lib/rims/service.rb, line 445
def server_restart_overlap_seconds
  # to avoid resource conflict between the new server and the old server.
  0
end
ssl_context() click to toggle source
# File lib/rims/service.rb, line 544
def ssl_context
  if (@config.dig('openssl')&.key? 'use_ssl') then
    use_ssl = @config.dig('openssl', 'use_ssl')
  else
    use_ssl = (@config.dig('openssl')&.key? 'ssl_context') || false
  end

  if (use_ssl) then
    ssl_context = OpenSSL::SSL::SSLContext.new
    if (ssl_config_expr = @config.dig('openssl', 'ssl_context')) then
      anon_mod = SSLContextConfigAttribute.new_module(ssl_context, base_dir)
      SSLContextConfigAttribute.eval_config(anon_mod, ssl_config_expr, 'ssl_context')
    end

    ssl_context
  end
end
status_file() click to toggle source
# File lib/rims/service.rb, line 430
def status_file
  file_path = @config.dig('daemon', 'status_file') || 'rims.pid'
  file_path = Pathname(file_path)
  if (file_path.relative?) then
    if (@config.key? 'base_dir') then # to avoid an error with DEFAULT_CONFIG
      file_path = base_dir + file_path
    end
  end
  file_path.to_s
end
thread_num() click to toggle source
# File lib/rims/service.rb, line 501
def thread_num
  @config.dig('server', 'thread_num') || 20
end
thread_queue_polling_timeout_seconds() click to toggle source
# File lib/rims/service.rb, line 509
def thread_queue_polling_timeout_seconds
  @config.dig('server', 'thread_queue_polling_timeout_seconds') || 0.1
end
thread_queue_size() click to toggle source
# File lib/rims/service.rb, line 505
def thread_queue_size
  @config.dig('server', 'thread_queue_size') || 20
end
write_lock_timeout_seconds() click to toggle source
# File lib/rims/service.rb, line 675
def write_lock_timeout_seconds
  @config.dig('drb_services', 'engine', 'write_lock_timeout_seconds') ||
    @config.dig('write_lock_timeout_seconds') || # for backward compatibility
    30
end

Private Instance Methods

get_configuration(collection) click to toggle source
# File lib/rims/service.rb, line 308
def get_configuration(collection)
  if (@config.key? 'base_dir') then # to avoid an error with DEFAULT_CONFIG
    self.class.get_configuration(collection, base_dir)
  else
    self.class.get_configuration(collection)
  end
end
make_key_value_store_params(collection) click to toggle source
# File lib/rims/service.rb, line 699
def make_key_value_store_params(collection)
  kvs_params = KeyValueStoreFactoryBuilderParams.new
  kvs_params.origin_type = KeyValueStore::FactoryBuilder.get_plug_in(collection['type'] ||
                                                                     collection['plug_in'] ||           # for backward compatibility
                                                                     @config['key_value_store_type'] || # for backward compatibility
                                                                     'gdbm')
  kvs_params.origin_config = get_configuration(collection)

  if (collection.key? 'use_checksum') then
    use_checksum = collection['use_checksum']
  elsif (@config.key? 'use_key_value_store_checksum') then
    use_checksum = @config['use_key_value_store_checksum'] # for backward compatibility
  else
    use_checksum = true   # default
  end

  kvs_params.middleware_list = []
  kvs_params.middleware_list << Checksum_KeyValueStore if use_checksum

  kvs_params
end