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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
module type BASE = sig
type t
val pp : t Fmt.t
val compare : t -> t -> int
val hash : t -> int
val equal : t -> t -> bool
module Set : Set.S with type elt = t
module Map : Map.S with type key = t
end
module type CONVERTER = sig
type t
type buffer
val to_t : buffer -> t
val of_t : t -> buffer
end
module type ENCODER = sig
type t
type init
type error
type encoder
val pp_error : error Fmt.t
val default : init -> encoder
val eval :
Cstruct.t
-> encoder
-> [`Flush of encoder | `End of encoder * int | `Error of error]
val flush : int -> int -> encoder -> encoder
val used : encoder -> int
end
module type DECODER = sig
type t
type init
type error
type decoder
val pp_error : error Fmt.t
val to_result : Cstruct.t -> (t, error) result
val default : init -> decoder
val eval :
decoder
-> [`Await of decoder | `End of Cstruct.t * t | `Error of Cstruct.t * error]
val refill : Cstruct.t -> decoder -> (decoder, error) result
val finish : decoder -> decoder
end
module type META = functor (Meta : Encore.Meta.S) -> sig
type e
val p : e Meta.t
end
module type DESC = sig
type 'a t
type e
val p : e t
end
module type INFLATE = sig
type t
type error
type window
val pp_error : error Fmt.t
val pp : t Fmt.t
val window_reset : window -> window
val window : unit -> window
val default : window -> t
val eval :
src:Cstruct.t
-> dst:Cstruct.t
-> t
-> [`Await of t | `Flush of t | `Error of t * error | `End of t]
val used_in : t -> int
val used_out : t -> int
val write : t -> int
val flush : int -> int -> t -> t
val refill : int -> int -> t -> t
end
module type DEFLATE = sig
type t
type error
val pp_error : error Fmt.t
val default : int -> t
val flush : int -> int -> t -> t
val no_flush : int -> int -> t -> t
val finish : t -> t
val used_in : t -> int
val used_out : t -> int
val eval :
src:Cstruct.t
-> dst:Cstruct.t
-> t
-> [`Flush of t | `Await of t | `Error of t * error | `End of t]
end
module type HASH = sig
include Digestif.S
val feed_cstruct : ctx -> Cstruct.t -> ctx
val compare : t -> t -> int
val hash : t -> int
val equal : t -> t -> bool
val read : t -> int -> int
module Set : Set.S with type elt = t
module Map : Map.S with type key = t
end
module type DIGEST = sig
type t
type hash
val digest : t -> hash
end
module type FILE = sig
type error
type t
val exists : t -> Fpath.t -> (bool, error) result Lwt.t
val delete : t -> Fpath.t -> (unit, error) result Lwt.t
val move : t -> Fpath.t -> Fpath.t -> (unit, error) result Lwt.t
(** [move] should be be atomic *)
type 'a fd constraint 'a = [< `Read | `Write]
val open_w : t -> Fpath.t -> ([`Write] fd, error) result Lwt.t
val open_r : t -> Fpath.t -> ([`Read] fd, error) result Lwt.t
val write :
Cstruct.t
-> ?off:int
-> ?len:int
-> [> `Write] fd
-> (int, error) result Lwt.t
val read :
Cstruct.t
-> ?off:int
-> ?len:int
-> [> `Read] fd
-> (int, error) result Lwt.t
val close : 'a fd -> (unit, error) result Lwt.t
end
module type MAPPER = sig
type fd
type error
type t
val pp_error : error Fmt.t
val openfile : t -> Fpath.t -> (fd, error) result Lwt.t
val length : fd -> (int64, error) result Lwt.t
val map : fd -> ?pos:int64 -> int -> (Cstruct.t, error) result Lwt.t
val close : fd -> (unit, error) result Lwt.t
end
module type DIR = sig
type error
type t
val exists : t -> Fpath.t -> (bool, error) result Lwt.t
val create : t -> Fpath.t -> (bool, error) result Lwt.t
val delete : t -> Fpath.t -> (unit, error) result Lwt.t
val contents :
t -> ?rel:bool -> Fpath.t -> (Fpath.t list, error) result Lwt.t
val current : t -> (Fpath.t, error) result Lwt.t
end
module type FS = sig
type error
type t
val pp_error : error Fmt.t
val is_dir : t -> Fpath.t -> (bool, error) result Lwt.t
val is_file : t -> Fpath.t -> (bool, error) result Lwt.t
module File : FILE with type t = t and type error = error
module Dir : DIR with type t = t and type error = error
module Mapper : MAPPER with type t = t and type error = error
val has_global_watches : bool
val has_global_checkout : bool
end