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

Copyable bookmark owning metadata only; never retains model, snapshot, view or page. Copies share immutable opaque bytes without allocation. Resource identity is process-local unless the provider supplies a portable identity/codec on export. This value alone cannot reopen a source or recreate missing model data. More...

#include <model_position.hpp>

Public Member Functions

 ModelBookmark ()=default
 Empty invalid bookmark; constructing it allocates no memory.
 ModelBookmark (const ModelBookmark &other)=default
 ModelBookmark (ModelBookmark &&other) noexcept
ModelBookmark & operator= (ModelBookmark other) noexcept
ModelResource resource () const noexcept
ModelPosition position () const noexcept
std::span< const std::byte > metadata () const noexcept
std::size_t storageBytes () const noexcept
constexpr std::uint32_t formatVersion () const noexcept

Static Public Member Functions

static std::expected< ModelBookmark, SourceError > create (ModelResource resource, ModelPosition position, std::span< const std::byte > metadata={}, BookmarkOptions options={})

Static Public Attributes

static constexpr std::uint32_t FORMAT_VERSION = 1
 Version of this in-memory bookmark schema.

Detailed Description

Copyable bookmark owning metadata only; never retains model, snapshot, view or page. Copies share immutable opaque bytes without allocation. Resource identity is process-local unless the provider supplies a portable identity/codec on export. This value alone cannot reopen a source or recreate missing model data.

Constructor & Destructor Documentation

◆ ModelBookmark() [1/2]

portals::ModelBookmark::ModelBookmark ( const ModelBookmark & other)
default
Parameters
otherImmutable metadata owner to share without allocating.

◆ ModelBookmark() [2/2]

portals::ModelBookmark::ModelBookmark ( ModelBookmark && other)
inlinenoexcept
Parameters
otherMetadata owner to transfer, leaving an empty invalid bookmark.

Member Function Documentation

◆ create()

std::expected< ModelBookmark, SourceError > portals::ModelBookmark::create ( ModelResource resource,
ModelPosition position,
std::span< const std::byte > metadata = {},
BookmarkOptions options = {} )
static
Parameters
resourceLogical resource and compatible-history generation.
positionValid typed position in a positive data revision.
metadataOptional provider-owned opaque bytes, copied before success.
optionsMaximum conservatively charged metadata size.
Returns
Immutable bookmark, INVALID_ARGUMENT, WOULD_BLOCK or NO_MEMORY.

◆ formatVersion()

std::uint32_t portals::ModelBookmark::formatVersion ( ) const
inlineconstexprnoexcept
Returns
In-memory schema version; persistence codecs are a separate capability.

◆ metadata()

std::span< const std::byte > portals::ModelBookmark::metadata ( ) const
noexcept
Returns
Metadata borrowed until this value or a copy is released.

◆ operator=()

ModelBookmark & portals::ModelBookmark::operator= ( ModelBookmark other)
inlinenoexcept
Parameters
otherComplete replacement; old storage is released after all fields change.
Returns
This value; copying immutable payload ownership does not allocate.

◆ position()

ModelPosition portals::ModelBookmark::position ( ) const
noexcept
Returns
Captured scalar position, with no borrowed row data.

◆ resource()

ModelResource portals::ModelBookmark::resource ( ) const
noexcept
Returns
Logical identity; empty for a default bookmark.

◆ storageBytes()

std::size_t portals::ModelBookmark::storageBytes ( ) const
noexcept
Returns
Conservatively charged metadata bytes, not process RSS.

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