morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::detail::CacheEntry Struct Reference

One entry of the session's query cache (spec 5 §5): one request in flight, one value, one error. More...

#include <interpreter.hpp>

Public Member Functions

 CacheEntry (reactive::Runtime &runtime)
 An empty entry.
ActionRecordInfo const * holding (std::string_view record) const
 The catalog entry of a record the entry holds.

Public Attributes

std::string key
 The cache key: model type, instance, action and canonical body.
std::string typeId
 The model type.
std::string action
 The action.
std::string body
 The body's JSON text.
bool evaluate = false
 Whether it is an evaluate query.
reactive::Signal< Value > value
 The value shown: the confirmed value with the optimistic layers over it.
reactive::Signal< bool > hasValue
 Whether a reply has been applied.
reactive::Signal< std::string > error
 The last failure's text; empty when none.
reactive::Signal< std::string > errorKind
 The last failure's kind; empty when none.
reactive::Signal< bool > pending
 Whether a request is in flight.
Value confirmed
 The value the server last confirmed.
std::vector< OptimisticLayer > layers
 The optimistic writes still waiting, oldest first.
std::uint64_t generation = 0
 The generation of the request in flight; a reply of an older one is dropped.
std::optional< std::chrono::milliseconds > fetchedAt
 When the last reply was applied.
bool stale = false
 Marked stale by a refetch, a backend switch or a change.
bool refetchAfter = false
 Marked stale while a fetch was in flight: that fetch may have read before the change, so when it settles the entry stays stale and fetches once more.
int users = 0
 The mounted queries using it.
reactive::TimerHandle evict
 The eviction timer, while no query uses it.
std::vector< std::string > secretFields
 The fields never cached.
std::string instanceToken
 The alias's instance token the entry was read through.
std::vector< ActionRecordInfo > records
 The records the entry's action returns, with the key field and paths of each; empty for an evaluate entry, which holds none.

Detailed Description

One entry of the session's query cache (spec 5 §5): one request in flight, one value, one error.

Definition at line 740 of file interpreter.hpp.

Constructor & Destructor Documentation

◆ CacheEntry()

morph::ui::detail::CacheEntry::CacheEntry ( reactive::Runtime & runtime)
inlineexplicit

An empty entry.

Parameters
runtimeThe runtime its signals belong to.

Definition at line 743 of file interpreter.hpp.

Member Function Documentation

◆ holding()

ActionRecordInfo const * morph::ui::detail::CacheEntry::holding ( std::string_view record) const
inlinenodiscard

The catalog entry of a record the entry holds.

Parameters
recordThe record's wire name.
Returns
It, or nullptr when the entry does not hold the record.

Definition at line 794 of file interpreter.hpp.

Member Data Documentation

◆ key

std::string morph::ui::detail::CacheEntry::key

The cache key: model type, instance, action and canonical body.

Definition at line 747 of file interpreter.hpp.

◆ typeId

std::string morph::ui::detail::CacheEntry::typeId

The model type.

Definition at line 749 of file interpreter.hpp.

◆ action

std::string morph::ui::detail::CacheEntry::action

The action.

Definition at line 751 of file interpreter.hpp.

◆ body

std::string morph::ui::detail::CacheEntry::body

The body's JSON text.

Definition at line 753 of file interpreter.hpp.

◆ evaluate

bool morph::ui::detail::CacheEntry::evaluate = false

Whether it is an evaluate query.

Definition at line 755 of file interpreter.hpp.

◆ value

reactive::Signal<Value> morph::ui::detail::CacheEntry::value

The value shown: the confirmed value with the optimistic layers over it.

Definition at line 757 of file interpreter.hpp.

◆ hasValue

reactive::Signal<bool> morph::ui::detail::CacheEntry::hasValue

Whether a reply has been applied.

Definition at line 759 of file interpreter.hpp.

◆ error

reactive::Signal<std::string> morph::ui::detail::CacheEntry::error

The last failure's text; empty when none.

Definition at line 761 of file interpreter.hpp.

◆ errorKind

reactive::Signal<std::string> morph::ui::detail::CacheEntry::errorKind

The last failure's kind; empty when none.

Definition at line 763 of file interpreter.hpp.

◆ pending

reactive::Signal<bool> morph::ui::detail::CacheEntry::pending

Whether a request is in flight.

Definition at line 765 of file interpreter.hpp.

◆ confirmed

Value morph::ui::detail::CacheEntry::confirmed

The value the server last confirmed.

Definition at line 767 of file interpreter.hpp.

◆ layers

std::vector<OptimisticLayer> morph::ui::detail::CacheEntry::layers

The optimistic writes still waiting, oldest first.

Definition at line 769 of file interpreter.hpp.

◆ generation

std::uint64_t morph::ui::detail::CacheEntry::generation = 0

The generation of the request in flight; a reply of an older one is dropped.

Definition at line 771 of file interpreter.hpp.

◆ fetchedAt

std::optional<std::chrono::milliseconds> morph::ui::detail::CacheEntry::fetchedAt

When the last reply was applied.

Definition at line 773 of file interpreter.hpp.

◆ stale

bool morph::ui::detail::CacheEntry::stale = false

Marked stale by a refetch, a backend switch or a change.

Definition at line 775 of file interpreter.hpp.

◆ refetchAfter

bool morph::ui::detail::CacheEntry::refetchAfter = false

Marked stale while a fetch was in flight: that fetch may have read before the change, so when it settles the entry stays stale and fetches once more.

Definition at line 778 of file interpreter.hpp.

◆ users

int morph::ui::detail::CacheEntry::users = 0

The mounted queries using it.

Definition at line 780 of file interpreter.hpp.

◆ evict

reactive::TimerHandle morph::ui::detail::CacheEntry::evict

The eviction timer, while no query uses it.

Definition at line 782 of file interpreter.hpp.

◆ secretFields

std::vector<std::string> morph::ui::detail::CacheEntry::secretFields

The fields never cached.

Definition at line 784 of file interpreter.hpp.

◆ instanceToken

std::string morph::ui::detail::CacheEntry::instanceToken

The alias's instance token the entry was read through.

Definition at line 786 of file interpreter.hpp.

◆ records

std::vector<ActionRecordInfo> morph::ui::detail::CacheEntry::records

The records the entry's action returns, with the key field and paths of each; empty for an evaluate entry, which holds none.

Definition at line 789 of file interpreter.hpp.


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