Module: Droonga::Path

Defined in:
lib/droonga/path.rb

Constant Summary collapse

BASE_DIR_ENV_NAME =
"DROONGA_BASE_DIR"

Class Method Summary collapse

Class Method Details

.baseObject



28
29
30
# File 'lib/droonga/path.rb', line 28

def base
  @base ||= Pathname.new(ENV[BASE_DIR_ENV_NAME] || Dir.pwd).expand_path
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

.bufferObject



68
69
70
# File 'lib/droonga/path.rb', line 68

def buffer
  state + "buffer"
end

.catalogObject



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).expand_path(base)
end

.configObject



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.expand_path
end

.default_log_fileObject



59
60
61
# File 'lib/droonga/path.rb', line 59

def default_log_file
  base + "droonga-engine.log"
end

.live_nodesObject



51
52
53
# File 'lib/droonga/path.rb', line 51

def live_nodes
  state + "live-nodes.json"
end

.node_statusObject



47
48
49
# File 'lib/droonga/path.rb', line 47

def node_status
  state + "status_file"
end

.serf_event_handler_error_fileObject



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_errorsObject



72
73
74
# File 'lib/droonga/path.rb', line 72

def serf_event_handler_errors
  state + "serf-event-handler-errors"
end

.setupObject



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.expand_path(base_dir)
end

.stateObject



43
44
45
# File 'lib/droonga/path.rb', line 43

def state
  base + "state"
end