This commit is contained in:
parent
5191e685bc
commit
0ffddb7a47
1 changed files with 4 additions and 5 deletions
|
|
@ -86,6 +86,7 @@ let get_key_dir_contents dir =
|
||||||
let sort_keys l = List.sort (fun a b -> Absolute.compare a.t2 b.t2) l
|
let sort_keys l = List.sort (fun a b -> Absolute.compare a.t2 b.t2) l
|
||||||
|
|
||||||
let split_in_periodes ~start ~end_ =
|
let split_in_periodes ~start ~end_ =
|
||||||
|
assert (start < end_);
|
||||||
(* no overlap on first periode *)
|
(* no overlap on first periode *)
|
||||||
let t1 = start in
|
let t1 = start in
|
||||||
let t2 = Absolute.add start Cfg.duration in
|
let t2 = Absolute.add start Cfg.duration in
|
||||||
|
|
@ -160,10 +161,9 @@ let init () =
|
||||||
let now = Absolute.of_ptime (Ptime_clock.now ()) in
|
let now = Absolute.of_ptime (Ptime_clock.now ()) in
|
||||||
let* () = check_periodes t.keys in
|
let* () = check_periodes t.keys in
|
||||||
let new_keys = gen_additional_keys_until_lookahead ~now t.keys in
|
let new_keys = gen_additional_keys_until_lookahead ~now t.keys in
|
||||||
let* () = list_iter write_key new_keys in
|
let+ () = list_iter write_key new_keys in
|
||||||
let keys = sort_keys (t.keys @ new_keys) in
|
let keys = sort_keys (t.keys @ new_keys) in
|
||||||
let t = { t with keys } in
|
{ t with keys }
|
||||||
Ok t
|
|
||||||
|
|
||||||
(* --- *)
|
(* --- *)
|
||||||
|
|
||||||
|
|
@ -189,8 +189,7 @@ let delete_key pub =
|
||||||
let* k = find_key pub in
|
let* k = find_key pub in
|
||||||
let l = List.filter (fun k -> k.pub <> pub) t.keys in
|
let l = List.filter (fun k -> k.pub <> pub) t.keys in
|
||||||
t.keys <- l;
|
t.keys <- l;
|
||||||
let+ () = delete_key_file k in
|
delete_key_file k
|
||||||
()
|
|
||||||
|
|
||||||
let delete_outdated ~now =
|
let delete_outdated ~now =
|
||||||
t.keys
|
t.keys
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue