Module Irmin.Sync

The default Sync implementation.

Native Synchronization

Parameters

module S : S

Signature

type db = S.t

Type type for store handles.

type commit = S.commit

The type for store heads.

type status = [
| `Empty
| `Head of commit
]

The type for remote status.

val status_t : db -> status Type.t

status_t db is the value type for status of remote db.

val pp_status : status Fmt.t

pp_status pretty-prints return statuses.

val fetch : db -> ?depth:int -> Irmin__S.remote -> (status[ `Msg of string ]) Stdlib.result Lwt.t

fetch t ?depth r populate the local store t with objects for the remote store r, using t's current branch. The depth parameter limits the history depth. Return `Empty if either the local or remote store do not have a valid head.

val fetch_exn : db -> ?depth:int -> Irmin__S.remote -> status Lwt.t

Same as fetch but raise Invalid_argument if either the local or remote store do not have a valid head.

type pull_error = [
| `Msg of string
| Merge.conflict
]

The type for pull errors.

val pp_pull_error : pull_error Fmt.t

pp_push_error pretty-prints pull errors.

val pull : db -> ?depth:int -> Irmin__S.remote -> [ `Merge of Info.f | `Set ] -> (statuspull_error) Stdlib.result Lwt.t

pull t ?depth r s is similar to fetch but it also updates t's current branch. s is the update strategy:

  • `Merge uses Head.merge. Can return a conflict.
  • `Set uses S.Head.set.
val pull_exn : db -> ?depth:int -> Irmin__S.remote -> [ `Merge of Info.f | `Set ] -> status Lwt.t

Same as pull but raise Invalid_arg in case of conflict.

type push_error = [
| `Msg of string
| `Detached_head
]

The type for push errors.

val pp_push_error : push_error Fmt.t

pp_push_error pretty-prints push errors.

val push : db -> ?depth:int -> Irmin__S.remote -> (statuspush_error) Stdlib.result Lwt.t

push t ?depth r populates the remote store r with objects from the current store t, using t's current branch. If b is t's current branch, push also updates the head of b in r to be the same as in t.

Note: Git semantics is to update b only if the new head if more recent. This is not the case in Irmin.

val push_exn : db -> ?depth:int -> Irmin__S.remote -> status Lwt.t

Same as push but raise Invalid_argument if an error happens.