package lwt-watcher
Install
Dune Dependency
Authors
Maintainers
Sources
md5=2922ce8459eeacbd3d8819b2915d7128
sha512=11b16761ff025c39adbd177de511b1a4c8cc3e307d96111e04ed3058ae5d7577f940e2fe7fc9cbdc54ef0923aab62820f87f457c95ba18ebd2050ff7b9f075f9
README.md.html
Lwt-watcher
Lwt-watcher implements a one-to-many publish/subscribe pattern.
Use
Lwt-watcher revolves around the notion of an 'a input
: a publishing/subscription point that carries values of type 'a
: create_input: unit -> 'a input
.
Any number of readers can subscribe to the input, each receiving its own 'a Lwt_stream.t
: create_stream: 'a input -> 'a Lwt_stream.t * stopper
. The second returned component is used to unsubscribed from the input: shutdown: stopper -> unit
.
Any number of writers can publish a value on the input: notify: 'a input -> 'a -> unit
. However, note that if multiple writers publish values on an input, the library user has to handle any required synchronization. An input can be closed: shutdown_input: 'a input -> unit
which in turns closes all associated streams.
Installation
opam install lwt-watcher