package irmin

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

Module Watch.MakeSource

Make builds an implementation of watch helpers.

Parameters

module K : Type.S
module V : Type.S

Signature

Watch Helpers

Sourcetype key = K.t

The type for store keys.

Sourcetype value = V.t

The type for store values.

Sourcetype watch

The type for watch handlers.

Sourcetype t

The type for watch state.

Sourceval 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.

Sourceval 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.

Sourceval v : unit -> t

Create a watch state.

Sourceval clear : t -> unit Lwt.t

Clear all register listeners in the given watch state.

Sourceval 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.

Sourceval 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.

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

Remove a watch handler.

Sourceval 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.

OCaml

Innovation. Community. Security.