type error =
The type error.
type t = {
i_off : int; |
i_pos : int; |
i_len : int; |
read : int; |
_length : int; |
_reference : reference; |
_source_length : int; |
_target_length : int; |
_hunk : hunk option; |
_tmp : Cstruct.t; |
state : state; |
}
The type of the Hunk decoder.
and state =
| Header of k |
| Stop |
| List of k |
| Is_insert of Cstruct.t * int * int |
| Is_copy of k |
| End |
| Exception of error |
and res =
| Wait of t | |
| Error of t * error | |
| Cont of t | |
| Ok of t * hunks | The type of compressed/delta-ified object. |
The type of the reference. It's a negative offset or the hash of the source object.
and hunks = {
reference : reference; | Reference to the source. |
length : int; | Inflated length of the serialized Hunk. |
source_length : int; | Length of the source object. |
target_length : int; | Expected length of the target object. |
}
partial_hunks t
returns a partial hunks to get some available information. hunks
.hunks is not available.
val eval : Cstruct.t -> t -> [ `Hunk of t * hunk | `Await of t | `Error of t * error | `Ok of t * hunks ]
eval src t
is:
`Await t
ifft
needs more input storage. The client must userefill
to provide a new buffer and then calleval
with`Await
until other value returned.`Hunk t
whent
can return a newhunk
. The client can callcontinue
to move to the next step of the process, otherwise the decode sticks on this situation. The value will be consumed then. If thehunk
isInsert
, the internalCstruct.t
need to be copied becauseeval
will erase the content then.`Ok (t, hunks)
whent
is done. We returns the complete valuehunks
. Then,t
sticks on this situation, the client can remove it.`Error (t, exn)
iff the decodert
meet anerror
exn
. The decoder can't continue and sticks in this situation.
refill off len t
provides a new t
with len
bytes to read, starting at off
. This byte range is read by calls to eval
with t
until `Await
is returned.
val used_in : t -> int
used_in ŧ
returns how many byte t
consumed in the current buffer noticed to the previous call of eval
.
val available_in : t -> int
available_in t
returns how many byte is available in the current buffer noticed to the previous call of eval
.
val read : t -> int
read t
returns how many byte t
read at the beginning. The client can assert than read t
is equal to length
noticed when he make
the new decoder.