Commit c20e23a4 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Remove Web_election.REGISTRABLE

That functor layer was there to delay the initialization of
authentication, but now that authentication has been moved out of
Web_election, it is no longer needed.
parent 4f187e8e
...@@ -32,13 +32,7 @@ open Web_services ...@@ -32,13 +32,7 @@ open Web_services
let ( / ) = Filename.concat let ( / ) = Filename.concat
module type REGISTRABLE = sig module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : WEB_ELECTION = struct
module Register (X : EMPTY) : WEB_ELECTION
end
module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
module Register (X : EMPTY) : WEB_ELECTION = struct
let uuid = Uuidm.to_string D.election.e_params.e_uuid let uuid = Uuidm.to_string D.election.e_params.e_uuid
...@@ -242,6 +236,4 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct ...@@ -242,6 +236,4 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
end end
end
end end
...@@ -25,8 +25,4 @@ open Signatures ...@@ -25,8 +25,4 @@ open Signatures
open Web_serializable_t open Web_serializable_t
open Web_signatures open Web_signatures
module type REGISTRABLE = sig module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : WEB_ELECTION
module Register (X : EMPTY) : WEB_ELECTION
end
module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE
...@@ -88,11 +88,10 @@ let register_election params web_params = ...@@ -88,11 +88,10 @@ let register_election params web_params =
} }
end in end in
let module P = (val web_params : WEB_PARAMS) in let module P = (val web_params : WEB_PARAMS) in
let module R = Web_election.Make (D) (P) in let module W = Web_election.Make (D) (P) in
(module R : Web_election.REGISTRABLE), fun () -> let election = (module W : WEB_ELECTION) in
fun () ->
(* starting from here, we do side-effects on the running server *) (* starting from here, we do side-effects on the running server *)
let module W = R.Register (struct end) in
let election = (module W : WEB_ELECTION) in
election_table := SMap.add uuid election !election_table; election_table := SMap.add uuid election !election_table;
election election
...@@ -136,8 +135,7 @@ let import_election f = ...@@ -136,8 +135,7 @@ let import_election f =
let state = ref `Open let state = ref `Open
end in end in
let web_params = (module X : WEB_PARAMS) in let web_params = (module X : WEB_PARAMS) in
let r, do_register = register_election params web_params in let do_register = register_election params web_params in
let module R = (val r : Web_election.REGISTRABLE) in
let module G = P.G in let module G = P.G in
let module KG = Election.MakeSimpleDistKeyGen (G) (LwtRandom) in let module KG = Election.MakeSimpleDistKeyGen (G) (LwtRandom) in
let public_keys = Lwt_io.lines_of_file f.f_public_keys in let public_keys = Lwt_io.lines_of_file f.f_public_keys in
...@@ -219,7 +217,7 @@ let import_election f = ...@@ -219,7 +217,7 @@ let import_election f =
lwt () = lwt () =
Ocsipersist.iter_step (fun uuid (raw_election, web_params) -> Ocsipersist.iter_step (fun uuid (raw_election, web_params) ->
let params = Group.election_params_of_string raw_election in let params = Group.election_params_of_string raw_election in
let _, do_register = register_election params web_params in let do_register = register_election params web_params in
let election = do_register () in let election = do_register () in
let module W = (val election : WEB_ELECTION) in let module W = (val election : WEB_ELECTION) in
assert (uuid = Uuidm.to_string W.election.e_params.e_uuid); assert (uuid = Uuidm.to_string W.election.e_params.e_uuid);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment