Module Eio_fs_chaos.OpSource

The operations a wrapper sees.

type kind = [
  1. | `Open_read
    (*

    An open for reading, of a file or a directory.

    *)
  2. | `Open_write
    (*

    An open that may write or create the file.

    *)
  3. | `Stat
    (*

    A stat, of a path or of an open file.

    *)
  4. | `Read
    (*

    A read of a file's bytes.

    *)
  5. | `Read_dir
    (*

    A listing of a directory's entries.

    *)
  6. | `Write
    (*

    A write of a file's bytes.

    *)
  7. | `Truncate
    (*

    A truncation of a file; offset is its new length.

    *)
  8. | `Sync
    (*

    A sync of a file or of a directory.

    *)
  9. | `Change
    (*

    A change to a directory's entries (mkdir, symlink, unlink, rmdir, rename) or to an entry's mode or owner (chmod, chown).

    *)
]

The type for operation kinds.

type t = {
  1. index : int;
    (*

    The operation's place among all of them, from 1.

    *)
  2. kind : kind;
  3. path : string;
    (*

    The path the operation names, as given to the wrapper: "/f" for a file f at the root of Eio_fs_mem.v. A file operation names the path the file was opened by.

    *)
  4. nth : int;
    (*

    The operation's place among those of its kind on its path, from 1.

    *)
  5. rank : int;
    (*

    The operation's place among those of its kind on any path, from 1. A check aims its faults by kind and rank.

    *)
  6. offset : int;
    (*

    Where a read or a write starts, a truncation's new length, 0 otherwise.

    *)
  7. length : int;
    (*

    The bytes a read asks for or a write offers.

    *)
  8. dest : string option;
    (*

    A rename's destination, as given to the directory it lands in.

    *)
}

The type for operations.

val pp : t Fmt.t

pp formats an operation for logs and reports, as #4 write /f@0+5: its index, its kind and its path, then, for a read or a write, @ its offset and + its length. A truncation ends with to its new length, and a rename with to its dest.