module Hash : sig ... end
The type of the reference. It's a negative offset or the hash of the source object.
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. The encoder expects the target raw (not the source) to write Insert
opcodes. The client must send the target raw continuously because internally, we assert than a continuous stream of the target raw and pick only the needed byte range.
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 does not expect any input. An eval
of the new t
will never return an `Await
value then.
val eval : Cstruct.t -> Cstruct.t -> t -> [ `Await of t | `Flush of t | `End of 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`End
is returned.`End t
whent
is done. Then,t
sticks on this situation, the client can remove it.`Error (t, exn)
iff the encodert
meet anerror
exn
. The encoder can't continue and sticks in this situation.