Source

screentime-monitor / rule_store.mli

open Core.Std
open Async.Std

type t

module Status : sig
  type t = Acked | Unacked with sexp, bin_io
end

val create : dir:string -> t Deferred.Or_error.t

val get_rules_with_status
  : t -> Username.t -> (Rule.t * Status.t) list Deferred.t

(* Sets the set of rules, inheriting ack-states from the existing ruleset *)
val set_rules
  :  t
  -> Username.t
  -> Rule.t list With_format.t
  -> unit Deferred.t

val get_rules
  :  t
  -> Username.t
  -> Rule.t list With_format.t Deferred.t

val ack   : t -> Username.t -> Rule.Name.t -> unit Deferred.t
val unack : t -> Username.t -> Rule.Name.t -> unit Deferred.t

(** Clears acks on rules other than the ones provided.  Used to clear
    acks on rules that are not in violation. *)
val clear_acks_on_other_rules
  : t -> Username.t -> Rule.Name.t list -> unit Deferred.t