Class: Splash::Backends::File
Constant Summary
Constants included
from Constants
Constants::AUTHOR, Constants::BACKENDS_STRUCT, Constants::CONFIG_FILE, Constants::COPYRIGHT, Constants::DAEMON_LOGMON_SCHEDULING, Constants::DAEMON_PID_FILE, Constants::DAEMON_PID_PATH, Constants::DAEMON_PROCESS_NAME, Constants::DAEMON_STDERR_TRACE, Constants::DAEMON_STDOUT_TRACE, Constants::EMAIL, Constants::EXECUTION_TEMPLATE, Constants::EXECUTION_TEMPLATE_TOKENS_LIST, Constants::LICENSE, Constants::LOGGERS_STRUCT, Constants::PROMETHEUS_PUSHGATEWAY_HOST, Constants::PROMETHEUS_PUSHGATEWAY_PORT, Constants::TRACE_PATH, Constants::TRANSPORTS_STRUCT, Constants::VERSION
Constants included
from Exiter
Exiter::EXIT_MAP
Instance Method Summary
collapse
Methods included from Loggers
#change_logger, #get_logger
Methods included from Config
#get_config
#checkconfig, #setupsplash
Methods included from Helpers
#daemonize, #get_process, #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
Methods included from Exiter
#splash_exit
Constructor Details
#initialize(store) ⇒ File
Returns a new instance of File.
10
11
12
13
14
|
# File 'lib/splash/backends/file.rb', line 10
def initialize(store)
@config = get_config[:backends][:stores][store]
@path = @config[:path]
ensure_backend
end
|
Instance Method Details
#del(options) ⇒ Object
31
32
33
|
# File 'lib/splash/backends/file.rb', line 31
def del(options)
::File.unlink("#{@path}/#{suffix_trace(options[:key])}") if File.exist?("#{@path}/#{suffix_trace(options[:key])}")
end
|
#exist?(options) ⇒ Boolean
35
36
37
|
# File 'lib/splash/backends/file.rb', line 35
def exist?(options)
return ::File.exist?("#{@path}/#{suffix_trace(options[:key])}")
end
|
#get(options) ⇒ Object
21
22
23
|
# File 'lib/splash/backends/file.rb', line 21
def get(options)
return ::File.readlines("#{@path}/#{suffix_trace(options[:key])}").join
end
|
#list(pattern = '*') ⇒ Object
16
17
18
19
|
# File 'lib/splash/backends/file.rb', line 16
def list(pattern='*')
pattern = suffix_trace(pattern)
return Dir.glob("#{@path}/#{pattern}").map{|item| ::File.basename(item,".trace") }
end
|
#put(options) ⇒ Object
25
26
27
28
29
|
# File 'lib/splash/backends/file.rb', line 25
def put(options)
::File.open("#{@path}/#{suffix_trace(options[:key])}", 'w') { |file|
file.write options[:value]
}
end
|