Module: Splash::Backends

Includes:
Config, Constants
Included in:
CLISplash::Commands, CLISplash::Config, Commands::CmdRecords, Commands::CommandWrapper, Logs::LogsRecords, Processes::ProcessRecords, Transfers::TxRecords
Defined in:
lib/splash/backends.rb,
lib/splash/backends/file.rb,
lib/splash/backends/redis.rb

Overview

generic backends module

Defined Under Namespace

Classes: File, Redis

Constant Summary

Constants included from Constants

Constants::AUTHOR, Constants::BACKENDS_STRUCT, Constants::CONFIG_FILE, Constants::COPYRIGHT, Constants::DAEMON_LOGMON_SCHEDULING, Constants::DAEMON_METRICS_SCHEDULING, Constants::DAEMON_PID_FILE, Constants::DAEMON_PROCESS_NAME, Constants::DAEMON_PROCMON_SCHEDULING, Constants::DAEMON_STDERR_TRACE, Constants::DAEMON_STDOUT_TRACE, Constants::DEFAULT_RETENTION, Constants::EMAIL, Constants::EXECUTION_TEMPLATE, Constants::EXECUTION_TEMPLATE_TOKENS_LIST, Constants::LICENSE, Constants::LOGGERS_STRUCT, Constants::PID_PATH, Constants::PROMETHEUS_ALERTMANAGER_URL, Constants::PROMETHEUS_PUSHGATEWAY_URL, Constants::PROMETHEUS_URL, Constants::TRACE_PATH, Constants::TRANSPORTS_STRUCT, Constants::VERSION, Constants::WEBADMIN_IP, Constants::WEBADMIN_PID_FILE, Constants::WEBADMIN_PID_PATH, Constants::WEBADMIN_PORT, Constants::WEBADMIN_PROCESS_NAME, Constants::WEBADMIN_PROXY, Constants::WEBADMIN_STDERR_TRACE, Constants::WEBADMIN_STDOUT_TRACE

Instance Method Summary collapse

Methods included from Config

#get_config, #rehash_config

Methods included from ConfigUtilities

#addservice, #checkconfig, #flush_backend, #setupsplash

Methods included from Helpers

#check_unicode_term, #daemonize, #format_by_extensions, #format_response, #get_processes, #group_root, #install_file, #is_root?, #make_folder, #make_link, #run_as_root, #search_file_in_gem, #user_root, #verify_file, #verify_folder, #verify_link, #verify_service

Instance Method Details

#get_backend(store) ⇒ Splash::Backends::<Type>|Hash

factory for backend

Parameters:

  • store (Symbol)

    the name of the store actually in [:execution_trace]

Returns:

  • (Splash::Backends::<Type>|Hash)

    with type in [:redis,:file] or Exiter case :configuration_error



15
16
17
18
19
20
21
22
23
24
# File 'lib/splash/backends.rb', line 15

def get_backend(store)
  splash_exit case: :configuration_error, more: "backend definition failure" if get_config[:backends][:stores][store].nil?
  backend = get_config[:backends][:stores][store][:type].to_s
  aclass = "Splash::Backends::#{backend.capitalize}"
  begin
    return Kernel.const_get(aclass)::new(store)
  rescue
    splash_exit case: :configuration_error, more: "Backend specified for store #{store} inexistant : #{backend}"
  end
end

#list_backendsHash

return list of configured backand

Returns:

  • (Hash)

    the backends hash list/structure



28
29
30
# File 'lib/splash/backends.rb', line 28

def list_backends
  return get_config[:backends][:stores]
end