summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-01-30 16:43:47 +0100
committerLinus Nordberg <linus@nordu.net>2017-01-30 16:43:47 +0100
commit1895b7740bf4540320f43b9a5283381169a817a4 (patch)
tree5c175811c58bd63a63545a923ac582e5c5c0ca38 /src
parente99900eb05cdb2f5fecb01c987396b49a0a31aa0 (diff)
Start permdb with options from config.erlmerge
For starting primary merge (dist phase) in read-only mode.
Diffstat (limited to 'src')
-rw-r--r--src/fsdb.erl6
-rw-r--r--src/perm.erl5
-rw-r--r--src/permdb.erl10
3 files changed, 10 insertions, 11 deletions
diff --git a/src/fsdb.erl b/src/fsdb.erl
index 4a85cdc..d644128 100644
--- a/src/fsdb.erl
+++ b/src/fsdb.erl
@@ -1,10 +1,10 @@
-%%% Copyright (c) 2014-2015, NORDUnet A/S.
+%%% Copyright (c) 2014-2015,2017, NORDUnet A/S.
%%% See LICENSE for licensing information.
-module(fsdb).
-behaviour(gen_server).
--export([start_link/2, stop/1, init_module/0]).
+-export([start_link/3, stop/1, init_module/0]).
-export([getvalue/2, addvalue/3, commit/1, commit/2]).
%% gen_server callbacks.
@@ -24,7 +24,7 @@ init_module() ->
end,
ets:new(?DIRECTORY_TABLE, [set, public, named_table]).
-start_link(Name, Filename) ->
+start_link(Name, Filename, _Options) ->
gen_server:start_link({local, Name}, ?MODULE,
[Name, Filename], []).
diff --git a/src/perm.erl b/src/perm.erl
index 2e12fdf..e571d23 100644
--- a/src/perm.erl
+++ b/src/perm.erl
@@ -1,4 +1,4 @@
-%%% Copyright (c) 2015, NORDUnet A/S.
+%%% Copyright (c) 2015,2017, NORDUnet A/S.
%%% See LICENSE for licensing information.
-module(perm).
@@ -8,7 +8,8 @@
start_link(Name, Filename) ->
Module = application:get_env(plop, db_backend, fsdb),
- Module:start_link(Name, Filename).
+ Options = application:get_env(plop, db_backend_opt, []),
+ Module:start_link(Name, Filename, Options).
stop(Name) ->
Module = application:get_env(plop, db_backend, fsdb),
diff --git a/src/permdb.erl b/src/permdb.erl
index 0a1765e..faca986 100644
--- a/src/permdb.erl
+++ b/src/permdb.erl
@@ -1,11 +1,11 @@
-%%% Copyright (c) 2015-2016, NORDUnet A/S.
+%%% Copyright (c) 2015-2017, NORDUnet A/S.
%%% See LICENSE for licensing information.
-module(permdb).
-behaviour(gen_server).
--export([start_link/2, start_link/3, stop/1, init_module/0]).
+-export([start_link/3, stop/1, init_module/0]).
-export([getvalue/2, addvalue/3, commit/1, commit/2, keyexists/2]).
%% gen_server callbacks.
@@ -61,10 +61,8 @@ init([Name, Filename, WriteFlag]) ->
init_module() ->
ok.
-start_link(Name, Filename) ->
- start_link(Name, Filename, write).
-
-start_link(Name, Filename, WriteFlag) ->
+start_link(Name, Filename, Options) ->
+ WriteFlag = proplists:get_value(write_flag, Options, write),
gen_server:start_link({local, Name}, ?MODULE,
[Name, Filename, WriteFlag], []).