Module type IO.S

type file
type error
type lock
type notifier
val create_lock : unit -> lock
val with_lock : lock -> (unit -> 'a) -> 'a

Protect one short synchronous state transition. The callback performs no Lwt effect and the lock must be released if it raises.

val create_notifier : unit -> notifier
val await : notifier -> unit Lwt.t

Create a waiter for the next notification. The implementation protects the returned promise from caller cancellation.

val notify : notifier -> unit
val dispose : notifier -> unit
val child : dir:string -> name:string -> string
val ensure_directory : string -> (unit, error) Stdlib.result Lwt.t
val open_append : string -> (file, error) Stdlib.result Lwt.t
val write : file -> string -> offset:int -> length:int -> (int, error) Stdlib.result Lwt.t

Return the number of bytes written from the requested slice. Partial progress is supported; zero progress is a writer failure. The implementation must not retain the string after the promise settles.

val flush : file -> (unit, error) Stdlib.result Lwt.t
val close : file -> (unit, error) Stdlib.result Lwt.t
val pp_error : Stdlib.Format.formatter -> error -> unit