From 43d65e7e322615eb9345e43294c3fb4930a37f53 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Mon, 15 Sep 2014 11:40:47 +0200 Subject: Add consistency/2. --- src/plop.erl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plop.erl b/src/plop.erl index 0fbd632..70b52c8 100644 --- a/src/plop.erl +++ b/src/plop.erl @@ -26,7 +26,7 @@ %% API. -export([start_link/2, stop/0]). -export([get_logid/0, serialise/1]). --export([add/1, sth/0, get/2]). +-export([add/1, sth/0, get/2, consistency/2]). %% API for tests. -export([read_keyfile_rsa/2, read_keyfiles_ec/2]). -export([testing_get_pubkey/0]). @@ -106,16 +106,14 @@ terminate(_Reason, _State) -> %%%%%%%%%%%%%%%%%%%% add(Data) when is_record(Data, timestamped_entry) -> gen_server:call(?MODULE, {add, Data}). - sth() -> gen_server:call(?MODULE, {sth, []}). - get(Start, End) -> gen_server:call(?MODULE, {get, {Start, End}}). - +consistency(TreeSizeFirst, TreeSizeSecond) -> + gen_server:call(?MODULE, {consistency, {TreeSizeFirst, TreeSizeSecond}}). get_logid() -> gen_server:call(?MODULE, {get, logid}). - testing_get_pubkey() -> gen_server:call(?MODULE, {test, pubkey}). %%%%%%%%%%%%%%%%%%%% @@ -147,6 +145,9 @@ handle_call({get, logid}, _From, Plop = #state{logid = LogID}) -> {reply, LogID, Plop}; +handle_call({consistency, {First, Second}}, _From, Plop) -> + {reply, ht:consistency(First - 1, Second - 1), Plop}; + handle_call({test, pubkey}, _From, Plop = #state{pubkey = PK}) -> {reply, PK, Plop}. -- cgit v1.1