Module Async_inotify
Async-friendly bindings to inotify, see man 7 inotify.
Be aware that the interface of inotify makes it easy to write code with race conditions or other subtle pitfalls. For instance, stat'ing a file then watching it means you have lost any events between the stat and the watch. Or the behavior when watching a path whose inode has multiple hardlinks is non-obvious.
type ttype file_info= string * Async.Unix.Stats.t
module Event : sig ... endtype modify_event_selector=[]
val create : ?modify_event_selector:modify_event_selector -> ?recursive:bool -> ?watch_new_dirs:bool -> string -> (t * file_info list) Async.Deferred.tcreate pathcreates an inotify watching path. Returns the inotify type t itself and the list of files currently being watched. By default, recursively watches all subdirectories of the given path. Seeadd_allfor caveats.
val create_empty : modify_event_selector:modify_event_selector -> t Async.Deferred.tcreate_empty modify_event_selectorcreates an inotify that watches nothing untiladdoradd_allis called.
val stop : t -> unit Async.Deferred.tstop tstop watching t
val add : t -> string -> unit Async.Deferred.tadd t pathadd the path to t to be watched
val add_all : ?skip_dir:((string * Async.Unix.Stats.t) -> bool Async.Deferred.t) -> t -> string -> file_info list Async.Deferred.tadd_all t pathwatchespathand all its current subdirectories recursively. This may generate events in the event pipe that are older than the returned file info, in the presence of concurrent modification to the filesystem.
val remove : t -> string -> unit Async.Deferred.tremove t pathremove the path from t
val stream : t -> Event.t Async.Stream.tstream treturns a stream of filesystem events
val pipe : t -> Event.t Async.Pipe.Reader.tpipe treturns a pipe of filesystem events