package irmin

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Make builds an implementation of watch helpers.

Parameters

module K : Tc.S0
module V : Tc.S0

Signature

Watch Helpers

type key = K.t

The type for store keys.

type value = V.t

The type for store values.

type watch

The type for watch handlers.

type t

The type for watch state.

val stats : t -> int * int

stats t is a tuple (k,a) represeting watch stats. k is the number of single key watchers for the store t and a the number of global watchers for t.

val notify : t -> key -> value option -> unit Lwt.t

Notify all listeners in the given watch state that a key has changed, with the new value associated to this key. None means the key has been removed.

val create : unit -> t

Create a watch state.

val clear : t -> unit

Clear all register listeners in the given watch state.

val watch_key : t -> key -> ?init:value -> (value diff -> unit Lwt.t) -> watch Lwt.t

Watch a given key for changes. More efficient than watch.

val watch : t -> ?init:(key * value) list -> (key -> value diff -> unit Lwt.t) -> watch Lwt.t

Add a watch handler. To watch a specific key, use watch_key which is more efficient.

val unwatch : t -> watch -> unit Lwt.t

Remove a watch handler.

val listen_dir : t -> string -> key:(string -> key option) -> value:(key -> value option Lwt.t) -> (unit -> unit) Lwt.t

Register a thread looking for changes in the given directory and return a function to stop watching and free up resources.

OCaml

Innovation. Community. Security.