Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::QuerySnapshot< T > Class Template Referencefinal

Derived model snapshot with distinct projection revision and exact source provenance. Retains the source pin and provider result for every borrowed row. Construction does not validate the page; QueryController validates worker results before creating this wrapper. More...

#include <model_query.hpp>

Inheritance diagram for portals::QuerySnapshot< T >:
portals::QuerySnapshot< T >portals::QuerySnapshot< T > portals::ModelSnapshot< T >

Public Member Functions

 QuerySnapshot (std::uint64_t projectionRevision, std::uint64_t sourceIdentity, std::uint64_t queryGeneration, std::shared_ptr< const ModelSnapshot< T > > source, QueryPage< T > result, RowRange page)
 Retain immutable source and result owners under a new projection revision.
ModelRows< T > read (RowRange range) const override
 Read only the already materialized page.
RowLookup locateRow (RowId id) const override
 Resolve identity in the page-local result.
std::uint64_t sourceRevision () const noexcept
 Original exact source revision.
std::uint64_t sourceIdentity () const noexcept
 Fixed provider session identity.
std::uint64_t queryGeneration () const noexcept
 Query generation represented by the page.
std::shared_ptr< const ModelSnapshot< T > > source () const noexcept
 Original source owner.
std::uint64_t totalRows () const noexcept
 Logical filtered result size before paging.
RowRange page () const noexcept
 Query page in filtered-result coordinates.
Public Member Functions inherited from portals::ModelSnapshot< T >
 ModelSnapshot (std::uint64_t revision, std::uint64_t rows)
 Define immutable metadata.
virtual ~ModelSnapshot ()=default
 Reclaim storage after all ranges, frames and workers release it.
std::uint64_t revision () const noexcept
 Provider data revision; strictly increasing on replacement.
std::uint64_t rowCount () const noexcept
 Logical count, without materializing rows.
virtual std::shared_ptr< const PositionChangeHistory > positionHistory () const
 Optional immutable ordering proof owner; default sources add no storage.

Detailed Description

template<class T>
class portals::QuerySnapshot< T >

Derived model snapshot with distinct projection revision and exact source provenance. Retains the source pin and provider result for every borrowed row. Construction does not validate the page; QueryController validates worker results before creating this wrapper.

Template Parameters
TImmutable domain row type satisfying ModelSnapshot<T>'s ownership contract.

Constructor & Destructor Documentation

◆ QuerySnapshot()

template<class T>
portals::QuerySnapshot< T >::QuerySnapshot ( std::uint64_t projectionRevision,
std::uint64_t sourceIdentity,
std::uint64_t queryGeneration,
std::shared_ptr< const ModelSnapshot< T > > source,
QueryPage< T > result,
RowRange page )
inline

Retain immutable source and result owners under a new projection revision.

Parameters
projectionRevisionMonotonic derived model revision; never a source revision.
sourceIdentityNonzero fixed provider-session identity.
queryGenerationAccepted query generation; zero denotes the initial unqueried source.
sourceExact immutable source pin, non-null.
resultExact-source page and total filtered row count, with non-null snapshot.
pageRequested interval within the filtered/sorted source.

Member Function Documentation

◆ locateRow()

template<class T>
RowLookup portals::QuerySnapshot< T >::locateRow ( RowId id) const
inlineoverridevirtual

Resolve identity in the page-local result.

Parameters
idExact stable source identity and generation.
Returns
Provider's bounded identity lookup capability and page-local index.

Reimplemented from portals::ModelSnapshot< T >.

◆ page()

template<class T>
RowRange portals::QuerySnapshot< T >::page ( ) const
inlinenoexcept

Query page in filtered-result coordinates.

Returns
Original requested page; model reads use page-local coordinates starting at zero.

◆ queryGeneration()

template<class T>
std::uint64_t portals::QuerySnapshot< T >::queryGeneration ( ) const
inlinenoexcept

Query generation represented by the page.

Returns
Accepted request generation, or zero for initial source data.

◆ read()

template<class T>
ModelRows< T > portals::QuerySnapshot< T >::read ( RowRange range) const
inlineoverridevirtual

Read only the already materialized page.

Parameters
rangeChecked interval in page-local model coordinates, not source coordinates.
Returns
Borrowed rows from the retained immutable result snapshot.

Implements portals::ModelSnapshot< T >.

◆ source()

template<class T>
std::shared_ptr< const ModelSnapshot< T > > portals::QuerySnapshot< T >::source ( ) const
inlinenoexcept

Original source owner.

Returns
Shared exact immutable source pin, safe to retain beyond controller lifetime.

◆ sourceIdentity()

template<class T>
std::uint64_t portals::QuerySnapshot< T >::sourceIdentity ( ) const
inlinenoexcept

Fixed provider session identity.

Returns
Nonzero identity issued for this query controller.

◆ sourceRevision()

template<class T>
std::uint64_t portals::QuerySnapshot< T >::sourceRevision ( ) const
inlinenoexcept

Original exact source revision.

Returns
Source pin's revision; never the derived ModelSnapshot revision.

◆ totalRows()

template<class T>
std::uint64_t portals::QuerySnapshot< T >::totalRows ( ) const
inlinenoexcept

Logical filtered result size before paging.

Returns
Total rows reported by the provider and validated against source size.

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