module Entry : Git.Pack.ENTRY with module Hash := Hash
module Hunk : Git.Pack.H with module Hash := Hash
The Map tree zhich zill represent the IDX file of the PACK stream.
type error =
| Deflate_error of Deflate.error | Appears when the deflate algorithm raises an error. |
| Invalid_hash of Hash.t | Appears when the hash requested does not exist. |
The type error.
val used_out : t -> int
used_out ŧ
returns how many byte t
wrote in the current buffer noticed to the previous call of eval
.
val used_in : t -> int
used_in ŧ
returns how many byte t
consumed in the current buffer noticed to the previous call of eval
.
flush off len t
provides t
with len
bytes to write, starting at off
. This byte range is written by calls to eval
with t
until `Flush
is returned.
finish t
provides a new t
which terminate to serialize the current Git object. The next call of eval
should not return an `Await
value unless the output space is enough to start to serialize the next entry.
expect t
returns the object expected to the serialization. At this time, the serializer requests the inflated raw of this git object. The client is able to use it only when eval
return `Await
. The encoder does not wqnt the ownership of the inflated raw, it access on it only as a read-only flow (that means, the src Cstruct.t
could be physicaly the same.
val idx : t -> (Checkseum.Crc32.t * int64) Hash.Map.t
idx t
returns a Map
tree which contains the CRC-32 checksum and the absolute offset for each Git object serialized. The client is able to use it only when eval
returns `End
.
Make a new encoder t
of the PACK stream.
tmp
is a Cstruct.t
used as an internal output of the Hunk Encoder H
. We let the user to allocate the optimized length for this temporary buffer and we take the ownership (so, you don't use it to another computer).
Then, the client need to notice the ordered list of what he wants to serialize.
val eval : Cstruct.t -> Cstruct.t -> t -> [ `Flush of t | `Await of t | `End of t * Hash.t | `Error of t * error ]
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.`Flush t
ifft
needs more output storage. The client must useflush
to provide a new buffer and then calleval
with`Flush
until other value returned.`End (t, hash)
whent
is done. Then,t
sticks on this situation, the client can remove it.hash
is the hash calculated of the PACK stream.`Error (t, exn)
iff the encodert
meet anerror
exn
. The encoder can't continue and sticks in this situation.