Library
Module
Module type
Parameter
Class
Class type
Conversion between GitHub and DataKit states.
module DK : Datakit_client.S
type tree = DK.Tree.t
The type for trees.
val repos : tree -> Datakit_github.Repo.Set.t Lwt.t
repos t
is the list of repositories stored in t
.
val statuses :
?commits:Datakit_github.Commit.Set.t ->
tree ->
Datakit_github.Status.Set.t Lwt.t
statuses t
is the list of status stored in t
.
val prs :
?repos:Datakit_github.Repo.Set.t ->
tree ->
Datakit_github.PR.Set.t Lwt.t
prs t
is the list of pull requests stored in t
.
val refs :
?repos:Datakit_github.Repo.Set.t ->
tree ->
Datakit_github.Ref.Set.t Lwt.t
refs t
is the list of Git references stored in t
.
val find : tree -> Datakit_github.Elt.id -> Datakit_github.Elt.t option Lwt.t
find t id
is the elements with ID id
in t
.
val pr : tree -> Datakit_github.PR.id -> Datakit_github.PR.t option Lwt.t
pr t id
is the pull-request with ID id
.
val ref : tree -> Datakit_github.Ref.id -> Datakit_github.Ref.t option Lwt.t
ref t id
is the Git reference with ID id
.
val status :
tree ->
Datakit_github.Status.id ->
Datakit_github.Status.t option Lwt.t
status t id
is the build status with ID id
.
val update_elt : DK.Transaction.t -> Datakit_github.Elt.t -> unit Lwt.t
update_elt t e
updates the element e
in the transaction t
.
val remove_elt : DK.Transaction.t -> Datakit_github.Elt.id -> unit Lwt.t
remove_elt t e
removes the element e
in the transaction t
.
val update_event : DK.Transaction.t -> Datakit_github.Event.t -> unit Lwt.t
update_event t e
applies the (webhook) event e
to the transaction t
.
type dirty = Datakit_github.Elt.IdSet.t
The type for dirty elements.
val stain : DK.Transaction.t -> dirty -> unit Lwt.t
stain tr d
makes all the elements in d
dirty.
val clean : DK.Transaction.t -> dirty -> unit Lwt.t
clean t d
removes d
from the list of dirty elements in t
.
val snapshot : t -> Datakit_github.Snapshot.t
snapshot t
is t
's in-memory snapshot.
val head : t -> DK.Commit.t
head t
is t
's head.
val diff : DK.Commit.t -> DK.Commit.t -> (Datakit_github.Diff.t * dirty) Lwt.t
diff x y
computes the difference between the commits x
and y
.
val of_branch :
debug:string ->
?old:t ->
DK.Branch.t ->
(DK.Transaction.t * t) Lwt.t
snapshot dbg ?old b
is a pair (t, s)
where s
is a snapshot of the branch b
and a t
is a transaction started on s
's commit. Note: this is expensive, so try to provide a (recent) old
snapshot if possible. In that case, the difference between the two snapshot's commits will be computed and only the minimal number of filesystem access will be performed to compute the new snapshot by updating the old one.
val of_commit : debug:string -> ?old:t -> DK.Commit.t -> t Lwt.t
Same as of_branch
but does not allow to update the underlying store.
val apply :
debug:string ->
Datakit_github.Diff.t ->
DK.Transaction.t ->
bool Lwt.t
apply d t
applies the snapshot diff d
into the datakit transaction t
. Returns true
iff the undelying datakit state has changed.