package obuilder

  1. Overview
  2. Docs

Store builds results using XFS with the reflink feature.

XFS is intended to behave consistently as it scales to large storage and many files, modern-day XFS was originally from SGI Irix. This store uses the reflink feature in XFS to share blocks between files, to support fast snapshots of directory trees and deduplicate file data for more efficient use of storage hardware.

For more details on the XFS implementation see XFS - Data Block Sharing (Reflink) and Upcoming XFS Work in Linux v4.8 v4.9 and v4.10+.

include S.STORE
type t
val root : t -> string

root t returns the root of the store.

val df : t -> float Lwt.t

df t returns the percentage of free space in the store.

val build : t -> ?base:S.id -> id:S.id -> (string -> (unit, 'e) Lwt_result.t) -> (unit, 'e) Lwt_result.t

build t ~id fn runs fn tmpdir to add a new item to the store under key id. On success, tmpdir is saved as id, which can be used as the base for further builds, until it is expired from the cache. On failure, nothing is recorded and calling build again will make another attempt at building it. The builder will not request concurrent builds for the same id (it will handle that itself). It will also not ask for a build that already exists (i.e. for which result returns a path).

  • parameter base

    Initialise tmpdir as a clone of base.

val delete : t -> S.id -> unit Lwt.t

delete t id removes id from the store, if present.

val result : t -> S.id -> string option Lwt.t

result t id is the path of the build result for id, if present.

val log_file : t -> S.id -> string Lwt.t

log_file t id is the path of the build logs for id. The file may not exist if the build has never been run, or failed.

val state_dir : t -> string

state_dir is the path of a directory which can be used to store mutable state related to this store (e.g. an sqlite3 database).

val cache : user:Obuilder_spec.user -> t -> string -> (string * (unit -> unit Lwt.t)) Lwt.t

cache ~user t name creates a writeable copy of the latest snapshot of the cache name. It returns the path of this fresh copy and a function which must be called to free it when done. If the cache name does not exist, it is first created (as an empty directory, and owned by user). When the copy is released, it is snapshotted to become the new latest version of the cache, unless the cache has already been updated since it was snapshotted, in which case this writeable copy is simply discarded.

val delete_cache : t -> string -> (unit, [> `Busy ]) Lwt_result.t

delete_cache t name removes the cache name, if present. If the cache is currently in use, the store may instead return Error `Busy.

val complete_deletes : t -> unit Lwt.t

complete_deletes t attempts to wait for previously executed deletes to finish, so that the free space is accurate.

val create : path:string -> t Lwt.t

create ~path creates a new XFS store where everything will be stored under path.

OCaml

Innovation. Community. Security.