UI-owned adapter coordinating a fixed provider session and one long-lived Model. Operations require the creating UI thread and a live tree context, outside frames. Release/close before WidgetTree. Criteria and token owners are worker-safe; controller is not. Model data revisions are projection revisions; source provenance is exposed separately.
More...
#include <model_query.hpp>
|
|
| ~QueryController () |
| | Close on UI without joining workers; retained frames and rows stay immutable.
|
| std::expected< QueryRequest< T, Q >, TreeError > | submit (Query< T, Q > query) |
| | Submit explicit provider work; supersedes the previous generation after reservation succeeds.
|
| std::expected< ModelFrame< T >, TreeError > | pin () const |
| | Pin the existing model; query queue acceptance may still be awaiting application.
|
| std::expected< ModelConsumer< T >, TreeError > | openRange () |
| | Open an unchanged low-level model interval consumer.
|
| std::expected< void, TreeError > | retryPublication () |
| | Retry retained notification and detect exact projection application; UI-only. Call after dispatch and on WOULD_BLOCK/NO_MEMORY recovery; acceptance still needs a later dispatch.
|
| std::expected< std::shared_ptr< const QuerySnapshot< T > >, TreeError > | snapshot () |
| | Inspect provenance of the model's currently applied projection.
|
| std::expected< std::optional< QueryError >, TreeError > | lastQueryError () const |
| | Inspect latest typed provider evaluation failure.
|
| std::expected< std::optional< TreeError >, TreeError > | lastError () const |
| | Inspect notification failure first, then existing model UI application failure.
|
| std::expected< void, TreeError > | close () |
| | Idempotent UI closure; workers retain source/criteria but receive stop requests.
|
template<class T, class Q>
class portals::QueryController< T, Q >
UI-owned adapter coordinating a fixed provider session and one long-lived Model. Operations require the creating UI thread and a live tree context, outside frames. Release/close before WidgetTree. Criteria and token owners are worker-safe; controller is not. Model data revisions are projection revisions; source provenance is exposed separately.
- Template Parameters
-
| T | Immutable domain row satisfying the snapshot ownership contract. |
| Q | Owning immutable domain criteria supporting destruction on any releasing thread. |
◆ close()
template<class T, class Q>
Idempotent UI closure; workers retain source/criteria but receive stop requests.
- Returns
- Success after disconnect, or WRONG_THREAD leaving ownership unchanged.
◆ create()
template<class T, class Q>
Create an unqueried source projection and existing bounded scheduler endpoints.
- Parameters
-
| tree | UI tree which must outlive this controller. |
| context | Live owner node for all completion/publication endpoints. |
| source | Initial immutable source pin, non-null; its values are initially presented unchanged. |
| provider | Non-null owned provider, destroyed on UI after close. |
| options | Positive finite query limits, captured into each token. |
| modelOptions | Existing model interval/consumer/work limits, unchanged by query limits. |
- Returns
- UI controller, tree/thread/frame error, INVALID_ARGUMENT, IDENTITY_EXHAUSTED, or NO_MEMORY.
◆ lastError()
template<class T, class Q>
Inspect notification failure first, then existing model UI application failure.
- Returns
- Sticky original failure, an empty optional, or UI/thread/tree error.
◆ lastQueryError()
template<class T, class Q>
Inspect latest typed provider evaluation failure.
- Returns
- Optional typed query error, or original UI/thread/tree error.
◆ openRange()
template<class T, class Q>
Open an unchanged low-level model interval consumer.
- Returns
- Consumer owned independently of query generations, or original model/tree error.
◆ pin()
template<class T, class Q>
Pin the existing model; query queue acceptance may still be awaiting application.
- Returns
- Immutable frame or UI/thread/tree/closed error.
◆ retryPublication()
template<class T, class Q>
Retry retained notification and detect exact projection application; UI-only. Call after dispatch and on WOULD_BLOCK/NO_MEMORY recovery; acceptance still needs a later dispatch.
- Returns
- Success for accepted/observed notification, or original tree/model/scheduler error.
◆ snapshot()
template<class T, class Q>
Inspect provenance of the model's currently applied projection.
- Returns
- Exact applied immutable wrapper, or original UI/thread/tree error.
◆ submit()
template<class T, class Q>
Submit explicit provider work; supersedes the previous generation after reservation succeeds.
- Parameters
-
| query | Owning criteria, exact source pin and bounded page; older source revisions are rejected. |
- Returns
- Worker token, tree/thread/frame error, INVALID_ARGUMENT, WOULD_BLOCK, NO_MEMORY, IDENTITY_EXHAUSTED, CALLBACK_FAILED if provider start throws, or CLOSED if provider start closes/cancels this token or synchronously submits a newer generation. Context removal returns its original tree error and cancels this token.
The documentation for this class was generated from the following file: