Module: Droonga::Path
- Defined in:
- lib/droonga/path.rb
Constant Summary collapse
- BASE_DIR_ENV_NAME =
"DROONGA_BASE_DIR"
Class Method Summary collapse
- .base ⇒ Object
- .base=(new_base) ⇒ Object
- .buffer ⇒ Object
- .catalog ⇒ Object
- .config ⇒ Object
- .databases(base_path = nil) ⇒ Object
- .default_log_file ⇒ Object
- .live_nodes ⇒ Object
- .node_status ⇒ Object
- .serf_event_handler_error_file ⇒ Object
- .serf_event_handler_errors ⇒ Object
- .setup ⇒ Object
- .state ⇒ Object
Class Method Details
.base ⇒ Object
28 29 30 |
# File 'lib/droonga/path.rb', line 28 def base @base ||= Pathname.new(ENV[BASE_DIR_ENV_NAME] || Dir.pwd). end |
.base=(new_base) ⇒ Object
32 33 34 35 |
# File 'lib/droonga/path.rb', line 32 def base=(new_base) @base = nil ENV[BASE_DIR_ENV_NAME] = new_base end |
.buffer ⇒ Object
68 69 70 |
# File 'lib/droonga/path.rb', line 68 def buffer state + "buffer" end |
.catalog ⇒ Object
63 64 65 66 |
# File 'lib/droonga/path.rb', line 63 def catalog base_file_name = ENV["DROONGA_CATALOG"] || "catalog.json" Pathname.new(base_file_name).(base) end |
.config ⇒ Object
55 56 57 |
# File 'lib/droonga/path.rb', line 55 def config base + "droonga-engine.yaml" end |
.databases(base_path = nil) ⇒ Object
37 38 39 40 41 |
# File 'lib/droonga/path.rb', line 37 def databases(base_path=nil) base_path ||= base path = Pathname(base_path) + "databases" path. end |
.default_log_file ⇒ Object
59 60 61 |
# File 'lib/droonga/path.rb', line 59 def default_log_file base + "droonga-engine.log" end |
.live_nodes ⇒ Object
51 52 53 |
# File 'lib/droonga/path.rb', line 51 def live_nodes state + "live-nodes.json" end |
.node_status ⇒ Object
47 48 49 |
# File 'lib/droonga/path.rb', line 47 def node_status state + "status_file" end |
.serf_event_handler_error_file ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/droonga/path.rb', line 76 def serf_event_handler_error_file now = Time.now name = sprintf("%04d-%02d-%02d_%02d-%02d-%02d.%d.error", now.year, now.month, now.day, now.hour, now.min, now.sec, now.nsec) serf_event_handler_errors + name end |
.serf_event_handler_errors ⇒ Object
72 73 74 |
# File 'lib/droonga/path.rb', line 72 def serf_event_handler_errors state + "serf-event-handler-errors" end |
.setup ⇒ Object
23 24 25 26 |
# File 'lib/droonga/path.rb', line 23 def setup base_dir = ENV[BASE_DIR_ENV_NAME] || Dir.pwd ENV[BASE_DIR_ENV_NAME] = File.(base_dir) end |
.state ⇒ Object
43 44 45 |
# File 'lib/droonga/path.rb', line 43 def state base + "state" end |