logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

NBD.Buffer - Persistent buffer used in AIO calls.

Documentation

       Module Buffer
        : sigend

       Persistent buffer used in AIO calls.

       typet = (char,Stdlib.Bigarray.int8_unsigned_elt,Stdlib.Bigarray.c_layout)Stdlib.Bigarray.Array1.t

       A buffer that persists across calls, used in NBD.aio_pread , NBD.aio_pwrite and similar.

       In  libnbd  ≤  1.18  this  was  a  specially implemented type.  This was inefficient as zero copy was not
       possible.

       In libnbd ≥ 1.20 this is just an alias for a Bigarray , so you can  use  functions  from  Bigarray.Array1
       directly if you prefer.  This also allows zero copy.

       This type is compatible with the bigstring and bigstringaf libraries.

       valalloc : int->t

       Allocate an uninitialized buffer.  The parameter is the size in bytes.

       In libnbd ≥ 1.20 this is an alias for Bigarray.Array1.create .

       valto_bytes : t->bytes

       Copy buffer to an OCaml bytes object.

       In libnbd ≥ 1.20 you can read from the bigarray directly to avoid copying if you want.

       valto_string : t->string

       Same as NBD.Buffer.to_bytes but returns a string instead.

       valof_bytes : bytes->t

       Copy an OCaml bytes object to a newly allocated buffer.

       In libnbd ≥ 1.20 you can write to the bigarray directly to avoid copying if you want.

       valof_string : string->t

       Same as NBD.Buffer.of_bytes but takes a string instead.

       valsize : t->int

       Return the size of the buffer.

       In libnbd ≥ 1.20 this is an alias for Bigarray.Array1.dim .

OCamldoc                                           2025-06-16                                      NBD.Buffer(3)

Module

       Module   NBD.Buffer

Name

       NBD.Buffer - Persistent buffer used in AIO calls.

See Also