package datakit-github

  1. Overview
  2. Docs
type t

A t is a named pointer to a commit.

val name : t -> string

name t is t's name.

val remove : t -> unit result

remove t deletes branch t. If t does not exist, this does nothing.

val head : t -> Commit.t option result

head t is the current head of the branch, or None if it doesn't currently exist.

val wait_for_head : t -> ?switch:Lwt_switch.t -> (Commit.t option -> [ `Finish of 'a | `Again | `Abort ] result) -> [ `Abort | `Finish of 'a ] result

wait_for_head t fn calls fn commit on the current commit. If it returns `Again then it waits for the commit to change and tries again. If switch is provided, then turning off the switch will make the wait return `Abort at the next opportunity.

val wait_for_path : t -> ?switch:Lwt_switch.t -> Datakit_client.Path.t -> ([ `File of Cstruct.t | `Dir of Tree.t | `Link of string | `Exec of Cstruct.t ] option -> [ `Finish of 'a | `Again | `Abort ] result) -> [ `Abort | `Finish of 'a ] result

wait_for_path is similar to wait_for_head, but waits for a particular sub-tree to change.

val fast_forward : t -> Commit.t -> unit result

fast_forward t commit changes t to point to commit if t's head is an ancestor of commit (or returns an error if not).

val with_transaction : t -> (Transaction.t -> 'a result) -> 'a result

with_transaction t fn is the result of applying fn to a new transaction on branch t. If the transaction has not been committed when fn trans returns, the transaction is aborted (and a warning is logged). Use Transaction.abort to avoid the warning.

val transaction : t -> Transaction.t result

transaction t creates a new transaction on top of the branch t. Must be closed with Transaction.abort or Transaction.commit. Use with_transaction to not have to worry about resource leaks..

OCaml

Innovation. Community. Security.