Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::SourceArena Class Referencefinal

Fixed-capacity monotonic storage shared by typed/text pages; no upstream fallback. Allocate all transitively owned page payload through this resource. Deallocation is deferred until the last arena owner releases it. Allocation and construction happen on one worker. More...

#include <source_budget.hpp>

Inheritance diagram for portals::SourceArena:
portals::SourceArenaportals::SourceArena

Public Member Functions

 ~SourceArena () override
 Release backing before returning its credit.
std::size_t used () const noexcept
std::size_t capacity () const noexcept

Static Public Member Functions

static std::expected< std::shared_ptr< SourceArena >, SourceError > create (SourceCredit credit)

Static Public Attributes

static constexpr std::size_t METADATA_BYTES = 4096
 Conservative per-allocation envelope for arena/control-block metadata.

Detailed Description

Fixed-capacity monotonic storage shared by typed/text pages; no upstream fallback. Allocate all transitively owned page payload through this resource. Deallocation is deferred until the last arena owner releases it. Allocation and construction happen on one worker.

Member Function Documentation

◆ capacity()

std::size_t portals::SourceArena::capacity ( ) const
noexcept
Returns
Allocatable payload capacity, excluding metadata allowance.

◆ create()

std::expected< std::shared_ptr< SourceArena >, SourceError > portals::SourceArena::create ( SourceCredit credit)
static
Parameters
creditReservation containing bytes for this arena and its metadata.
Returns
Owning storage, or NO_MEMORY/PAGE_TOO_LARGE; rejected credit is released.

◆ used()

std::size_t portals::SourceArena::used ( ) const
noexcept
Returns
Number of occupied bytes in the fixed payload block.

The documentation for this class was generated from the following file: