package irmin-pack

  1. Overview
  2. Docs
Irmin backend which stores values in a pack file

Install

Dune Dependency

Authors

Maintainers

Sources

irmin-3.4.2.tbz
sha256=964512f77697947a73dd1875c634d6804e98f14167c5aadd3c4f85b5f30ffb53
sha512=d56d3285daa2dd36f1eaff867af5c8f44c61bba4de1a5c7bb5347652dbc460c343483ab61de1a9302f664af357eacc964dc5c8b4477f6d01372dc028b162e98b

doc/src/irmin-pack.unix/gc_intf.ml.html

Source file gc_intf.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
(*
 * Copyright (c) 2022-2022 Tarides <contact@tarides.com>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *)

open! Import

module type Args = sig
  module Fm : File_manager.S with module Io = Io.Unix
  module Async : Async.S
  module Dict : Dict.S with module Fm = Fm
  module Errs : Io_errors.S with module Io = Fm.Io
  module Dispatcher : Dispatcher.S with module Fm = Fm

  type hash
  type key = hash Pack_key.t [@@deriving irmin]

  module Hash : sig
    val hash_size : int
  end

  module Contents_store : sig
    type 'a t

    val purge_lru : 'a t -> unit
  end

  module Node_value : sig
    type t
    type step

    val pred :
      t ->
      (step option * [ `Contents of key | `Inode of key | `Node of key ]) list
  end

  module Node_store : sig
    type 'a t

    val v :
      config:Irmin.Backend.Conf.t ->
      fm:Fm.t ->
      dict:Dict.t ->
      dispatcher:Dispatcher.t ->
      read t

    val unsafe_find :
      check_integrity:bool -> [< read ] t -> key -> Node_value.t option

    val purge_lru : 'a t -> unit
  end

  module Commit_value : sig
    type t

    val node : t -> key
    val parents : t -> key list
  end

  module Commit_store :
    Pack_store.S
      with type value = Commit_value.t
       and type key = key
       and type file_manager = Fm.t
       and type dict = Dict.t
       and type dispatcher = Dispatcher.t
       and type hash = hash
end

type stats = {
  duration : float;
  finalisation_duration : float;
  read_gc_output_duration : float;
  transfer_latest_newies_duration : float;
  swap_duration : float;
  unlink_duration : float;
}
[@@deriving irmin ~pp]

module type S = sig
  type t
  (** A running GC process. *)

  module Args : Args

  val v :
    root:string ->
    generation:int ->
    unlink:bool ->
    offset:int63 ->
    dispatcher:Args.Dispatcher.t ->
    fm:Args.Fm.t ->
    contents:read Args.Contents_store.t ->
    node:read Args.Node_store.t ->
    commit:read Args.Commit_store.t ->
    Args.key ->
    t
  (** Creates and starts a new GC process. *)

  val finalise :
    wait:bool ->
    t ->
    ([> `Running | `Finalised of stats ], Args.Errs.t) result Lwt.t
  (** [finalise ~wait t] returns the state of the GC process.

      If [wait = true], the call will block until GC finishes. *)

  val on_finalise : t -> ((stats, Args.Errs.t) result -> unit Lwt.t) -> unit
  (** Attaches a callback to the GC process, which will be called when the GC
      finalises. *)

  val cancel : t -> bool
end

module type Sigs = sig
  module type Args = Args

  type nonrec stats = stats = {
    duration : float;
    finalisation_duration : float;
    read_gc_output_duration : float;
    transfer_latest_newies_duration : float;
    swap_duration : float;
    unlink_duration : float;
  }

  module type S = S
end
OCaml

Innovation. Community. Security.