package uring
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Uring.RegionSource
Region handles carving up a block of external memory into smaller chunks. This is currently just a slab allocator of a fixed size, on the basis that most IO operations operate on predictable chunks of memory. Since the block of memory in a region is contiguous, it can be used in Uring's fixed buffer model to map it into kernel space for more efficient IO.
t is a contiguous region of memory
chunk is an offset into a region of memory allocated from some region t. It is of a length set when the region t associated with it was initialised.
No_space is raised when an allocation request cannot be satisfied.
init ~block_size buf slots initialises a region from the buffer buf with total size of block_size * slots.
alloc t will allocate a single chuck of length block_size from the region t.
free chunk will return the memory chunk back to the region t where it can be reallocated.
to_offset chunk will convert the chunk into an integer offset in its associated region. This can be used in IO calls involving that memory.
to_cstruct chunk is a cstruct of chunk's slice of the region. Note that this is a zero-copy view into the underlying region t and so chunk should not be freed until this cstruct is no longer used.
to_bigstring is like to_cstruct, but creates a Bigarray. Note that this is a zero-copy view into the underlying region t and so chunk should not be freed until this Bigarray reference is no longer used.
to_string ?len chunk will return a copy of chunk as an OCaml string.