package irmin-git

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type path = string

The type for filesystem paths.

Read Operations

val file_exists : path -> bool Lwt.t

Does the given file exists? See Sys.file_exists

val directories : path -> string list Lwt.t

List the subdirs.

val files : path -> string list Lwt.t

List the subfiles. The result filenames are absolute.

val read_file : path -> Cstruct.t option Lwt.t

Read a file and return a mutable C-like structure with its contents. Return None is the file does not exist.

val stat_info : path -> Git.Index.stat_info option Lwt.t

Return the stats of the given file.

Write Operations

val mkdir : path -> unit Lwt.t

Create a directory.

type lock

The type for locks, depends on the backend.

val lock_file : path -> lock

lock_file f is the lock associated to the file f, which is hold when test_and_set_file, set_file and remove_file are called (if provided to the function calls). Depending on the backend it can be mutexes or flocks.

val write_file : ?temp_dir:string -> ?lock:lock -> path -> Cstruct.t -> unit Lwt.t

Write a bigarray to a file. Atomicity is guaranteed if lock if provided. temp_dir can be used to create temporary files, By defaut, temp_dir is Filename.get_temp_dir_name.

val test_and_set_file : ?temp_dir:string -> lock:lock -> path -> test:Cstruct.t option -> set:Cstruct.t option -> bool Lwt.t

Atomic update of file contents. temp_dir can be used to create temporary files, By defaut, temp_dir is Filename.get_temp_dir_name.

val remove_file : ?lock:lock -> path -> unit Lwt.t

Remove a file. Atomicity is guaranteed if lock is provided.

val remove_dir : path -> unit Lwt.t

Remove a directory, recursively. All the files it contains will be deleted, without taking any lock, so use remove_file recursively first for atomicity guarantees.

val chmod : ?lock:lock -> path -> [ `Exec ] -> unit Lwt.t

Change the file mode to exec mode. Atomicity is guaranteed if lock is provided.

OCaml

Innovation. Community. Security.