Some users will need to directly implement the MultiBufAllocator
interface in order to provide allocation out of a particular region, provide particular allocation policy, fix chunks to some size (such as MTU size - header for socket implementations), or specify other custom behavior. These users will also need to understand and implement the ChunkRegionTracker
API.
A simple implementation of a ChunkRegionTracker
is provided, called HeaderChunkRegionTracker
. It stores its Chunk
and region metadata in a Allocator
allocation alongside the data. The allocation process is synchronous, making this class suitable for testing. The allocated region or Chunk
must not outlive the provided allocator.
Another ChunkRegionTracker
specialization is the lightweight SingleChunkRegionTracker
, which does not rely on Allocator
and uses the provided memory view to create a single chunk. This is useful when a single Chunk
is sufficient at no extra overhead. However, the user needs to own the provided memory and know when a new Chunk
can be requested.
Classes | |
class | pw::multibuf::HeaderChunkRegionTracker |
class | pw::multibuf::SingleChunkRegionTracker |