Skip to content

Commit

Permalink
better default handling in config (if dir is not defined, it's the ho…
Browse files Browse the repository at this point in the history
…me dir); Lwt-2.3.2
  • Loading branch information
toolslive committed Nov 24, 2011
1 parent 69c5eff commit 9bf8129
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
4 changes: 2 additions & 2 deletions COMPILING
@@ -1,8 +1,8 @@
PREREQUISITES:

ocaml 3.12
ocaml 3.12.1
findlib 1.2.7
lwt 2.3.0
lwt 2.3.2
ounit 1.1.0
react 0.9.2
camlbz2 0.6.0
Expand Down
18 changes: 8 additions & 10 deletions cfg/arakoon.ini
Expand Up @@ -33,12 +33,12 @@ cluster_id = ricky
ip = 127.0.0.1
client_port = 4000
messaging_port = 4010
home = /tmp/arakoon_0
home = /tmp/arakoon/arakoon_0
#optional different directory for .tlog, .tlc and friends
#tlog_dir = /tmp
log_dir = /tmp/arakoon_0
#tlog_dir = /tmp/arakoon/arakoon_0
#log_dir = /tmp/arakoon/arakoon_0
# available levels are: debug info notice warning error fatal
log_level = debug
log_level = info
# for debugging
#laggy = true
# report every x seconds (default = 300)
Expand All @@ -48,19 +48,17 @@ log_level = debug
ip = 127.0.0.1
client_port = 4001
messaging_port = 4011
home = /tmp/arakoon_1
log_dir = /tmp/arakoon_1
log_level = debug
home = /tmp/arakoon/arakoon_1
log_level = info


[arakoon_2]
name = arakoon_2
ip = 127.0.0.1
client_port = 4002
messaging_port = 4012
home = /tmp/arakoon_2
log_dir = /tmp/arakoon_2
log_level = debug
home = /tmp/arakoon/arakoon_2
log_level = info

#[learner_0]
#ip = 127.0.0.1
Expand Down
12 changes: 8 additions & 4 deletions ctrl/nodes.ml
Expand Up @@ -5,6 +5,7 @@ module Node = struct
let names = ["arakoon_0";"arakoon_1";"arakoon_2"]
let cfg_name = (Unix.getcwd()) ^ "/cfg/arakoon.ini"

let root = "/tmp/arakoon"
let _node_cmd fmt name =
let cmd = Printf.sprintf fmt exec name cfg_name in
print_endline cmd;
Expand All @@ -22,8 +23,8 @@ module Node = struct

let monitor_all () =
let tab x = Printf.sprintf
"--tab-with-profile=Default -e 'tail -f /tmp/%s/%s.log' -t '%s' "
x x x
"--tab-with-profile=Default -e 'tail -f %s/%s/%s.log' -t '%s' "
root x x x
in
let tabs = List.map tab names in
let cmd = List.fold_left (^) "gnome-terminal " tabs in
Expand All @@ -32,11 +33,14 @@ module Node = struct

let mkdirs () =
let mkdir x =
let dir_name = Printf.sprintf "/tmp/%s" x in
let dir_name = Printf.sprintf "%s/%s" root x in
Unix.mkdir dir_name 0o755
in List.map mkdir names

let clean_dirs () =
List.iter (fun name -> ignore (Sys.command ("rm -rf /tmp/" ^ name))) names
let dir_name name = Printf.sprintf "%s/%s" root name in
List.iter
(fun name -> ignore (Sys.command ("rm -rf " ^ (dir_name name))))
names

end
6 changes: 3 additions & 3 deletions debian/control
Expand Up @@ -2,8 +2,8 @@ Source: arakoon
Section: database
Priority: extra
Maintainer: Romain Slootmaekers <romain.slootmaekers@incubaid.com>
Build-Depends: debhelper (>= 7), ocaml-nox (>= 3.11.1-3~), dh-ocaml (>= 0.9), ocaml-findlib (>= 1.2.5),
liblwt-ocaml-dev (>= 2.1.1), libounit-ocaml-dev (>= 1.0.3), libbz2-ocaml-dev (>= 0.6.0),
Build-Depends: debhelper (>= 7), ocaml-nox (>= 3.12.0), dh-ocaml (>= 0.9), ocaml-findlib (>= 1.2.5),
liblwt-ocaml-dev (>= 2.3.2), libounit-ocaml-dev (>= 1.0.3), libbz2-ocaml-dev (>= 0.6.0),
libbz2-dev (>= 1.0.5), texlive (>= 2009), texlive-font-utils (>= 2009), texlive-latex-base (>= 2009)
Standards-Version: 3.8.3
Homepage: http://www.arakoon.org
Expand All @@ -21,4 +21,4 @@ Architecture : any
Section: ocaml
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: ocaml client library for Arakoon
Implementation of the Arakoon protocol
Implementation of the Arakoon protocol
10 changes: 8 additions & 2 deletions src/node/node_cfg.ml
Expand Up @@ -210,7 +210,10 @@ module Node_cfg = struct
let client_port = get_int "client_port" in
let messaging_port = get_int "messaging_port" in
let home = get_string "home" in
let tlog_dir = try get_string "tlog_dir" with _ -> home in
let tlog_dir =
try get_string "tlog_dir"
with _ -> home
in
let log_level = String.lowercase (get_string "log_level") in
let is_laggy = get_bool "laggy" in
let is_learner = get_bool "learner" in
Expand All @@ -221,7 +224,10 @@ module Node_cfg = struct
else []
in
let lease_period = _get_lease_period inifile in
let log_dir = get_string "log_dir" in
let log_dir =
try get_string "log_dir"
with _ -> home
in
let reporting = Ini.get inifile node_name "reporting" Ini.p_int (Ini.default 300) in
{node_name;
ip;
Expand Down

0 comments on commit 9bf8129

Please sign in to comment.