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 : Type.S
module V : Type.S

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 v : unit -> t

Create a watch state.

val clear : t -> unit Lwt.t

Clear all register listeners in the given watch state.

val watch_key : t -> key -> ?init:value -> (value Diff.t -> 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.t -> 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) Lwt.t

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