5#include <portals/model_position.hpp>
84 virtual std::expected<ModelBookmark, NavigationCheckpointError>
decode(std::span<const std::byte> payload,
87 std::stop_token stop = {})
const = 0;
99class NavigationCheckpoint {
102 NavigationCheckpoint() =
default;
109 static std::expected<NavigationCheckpoint, NavigationCheckpointError>
116 static std::expected<NavigationCheckpoint, NavigationCheckpointError>
124 std::stop_token stop = {})
const;
126 std::span<const std::byte>
bytes() const noexcept;
129 std::shared_ptr<const std::vector<std::
byte>> bytes_;
144 virtual std::expected<std::size_t, NavigationCheckpointError>
read(std::span<std::byte> output,
145 std::stop_token stop = {}) = 0;
149 virtual std::expected<void, NavigationCheckpointError>
write(std::span<const std::byte> bytes,
150 std::stop_token stop = {}) = 0;
156std::expected<NavigationCheckpoint, NavigationCheckpointError>
158 std::stop_token stop = {});
164 std::stop_token stop = {});
Copyable bookmark owning metadata only; never retains model, snapshot, view or page....
Definition model_position.hpp:66
Explicit provider conversion; no generic serializer for process-local RowId/SourceStamp exists....
Definition navigation_checkpoint.hpp:66
virtual std::expected< ModelBookmark, NavigationCheckpointError > decode(std::span< const std::byte > payload, PositionKind kind, PositionAffinity affinity, NavigationCheckpointRole role, std::stop_token stop={}) const =0
virtual NavigationCodecDescriptor descriptor() const noexcept=0
virtual std::expected< std::size_t, NavigationCheckpointError > encode(const NavigationCheckpointEntry &entry, std::span< std::byte > output, std::stop_token stop={}) const =0
virtual ModelResource resource() const noexcept=0
Optional synchronous storage seam; no filesystem or scheduler is installed implicitly....
Definition navigation_checkpoint.hpp:138
virtual std::expected< void, NavigationCheckpointError > write(std::span< const std::byte > bytes, std::stop_token stop={})=0
virtual std::expected< std::size_t, NavigationCheckpointError > read(std::span< std::byte > output, std::stop_token stop={})=0
Immutable owning checkpoint; copies share bytes and never retain providers or UI objects....
Definition navigation_checkpoint.hpp:99
static std::expected< NavigationCheckpoint, NavigationCheckpointError > capture(std::span< const NavigationCheckpointEntry > entries, const NavigationBookmarkCodec &codec, NavigationCheckpointOptions options={}, std::stop_token stop={})
static std::expected< NavigationCheckpoint, NavigationCheckpointError > parse(std::span< const std::byte > bytes, NavigationCheckpointOptions options={}, std::stop_token stop={})
std::expected< std::vector< NavigationCheckpointEntry >, NavigationCheckpointError > restore(const NavigationBookmarkCodec &codec, NavigationCheckpointOptions options={}, std::stop_token stop={}) const
static constexpr std::uint32_t FORMAT_VERSION
Binary envelope schema, independent of provider version.
Definition navigation_checkpoint.hpp:101
std::span< const std::byte > bytes() const noexcept
Public Portals API.
Definition action.hpp:8
NavigationCheckpointError
Persistence failures are separate from navigation resolution outcomes.
Definition navigation_checkpoint.hpp:26
@ CORRUPT_INPUT
Malformed envelope, invalid checksum or inconsistent provider result.
Definition navigation_checkpoint.hpp:28
@ TOO_LARGE
Configured envelope, entry, identity or count limit exceeded.
Definition navigation_checkpoint.hpp:29
@ STORAGE_FAILURE
Storage read/write failed; existing memory values remain unchanged.
Definition navigation_checkpoint.hpp:37
@ WRONG_RESOURCE
Portable resource qualification does not match the supplied provider.
Definition navigation_checkpoint.hpp:33
@ UNSUPPORTED_CODEC
Saved codec identifier does not match the supplied provider.
Definition navigation_checkpoint.hpp:32
@ PROVIDER_FAILURE
A provider/storage callback threw an unexpected exception.
Definition navigation_checkpoint.hpp:39
@ UNSUPPORTED_CODEC_VERSION
Matching provider codec name uses an unsupported schema version.
Definition navigation_checkpoint.hpp:31
NavigationCheckpointRole
Purpose of a saved location; EDIT_ANCHOR never conveys write authority.
Definition navigation_checkpoint.hpp:12
@ SELECTION
One selected location; multiple entries preserve their order.
Definition navigation_checkpoint.hpp:15
@ READING_ANCHOR
Reading location, independently of current selection.
Definition navigation_checkpoint.hpp:14
@ CURRENT
Current record or text caret location.
Definition navigation_checkpoint.hpp:13
@ EDIT_ANCHOR
Destination location only; capabilities and versions must be checked again.
Definition navigation_checkpoint.hpp:16
PositionAffinity
Preferred surviving side when a position is deleted or text is inserted beside a mark.
Definition model_position.hpp:42
PositionKind
Position interpretation; a row, a gap, and a text mark are not interchangeable.
Definition model_position.hpp:35
std::expected< NavigationCheckpoint, NavigationCheckpointError > loadNavigationCheckpoint(NavigationCheckpointStorage &storage, NavigationCheckpointOptions options={}, std::stop_token stop={})
@ NO_MEMORY
Allocation failed at a runner exception boundary.
Definition application.hpp:33
@ CLOSED
Owner, node scope, scheduler or completion endpoint is closed.
Definition async.hpp:28
@ CANCELLED
Explicit cancellation or replacement stopped the invocation.
Definition async.hpp:29
@ INVALID_ARGUMENT
Empty task, callback or immutable data owner, or invalid policy.
Definition async.hpp:26
@ UNSUPPORTED_VERSION
The export does not declare the supported schema.
Definition diagnostics.hpp:81
std::expected< void, NavigationCheckpointError > saveNavigationCheckpoint(const NavigationCheckpoint &checkpoint, NavigationCheckpointStorage &storage, std::stop_token stop={})
@ UNSUPPORTED
The application explicitly excludes this annotated phase.
Definition key_binding.hpp:44
Checked bookmark capacity, independent of logical source length.
Definition model_position.hpp:57
Logical resource namespace, distinct from its current delivery session. Reuse an existing SourceStamp...
Definition model_position.hpp:21
A metadata-only position and its purpose; never a model value or draft.
Definition navigation_checkpoint.hpp:20
ModelBookmark bookmark
Qualified in-memory position; provider codecs translate its resource identity.
Definition navigation_checkpoint.hpp:22
NavigationCheckpointRole role
Intended navigation channel.
Definition navigation_checkpoint.hpp:21
Positive metadata capacities; none depends on the logical model extent.
Definition navigation_checkpoint.hpp:43
std::size_t maxEntries
Maximum owning positions restored by one checkpoint.
Definition navigation_checkpoint.hpp:45
std::size_t maxIdentityBytes
Maximum bytes of each codec name and portable resource key.
Definition navigation_checkpoint.hpp:47
std::size_t maxBytes
Maximum encoded envelope bytes, including all headers and payloads.
Definition navigation_checkpoint.hpp:44
BookmarkOptions bookmarks
Maximum charged bytes of each decoded in-memory bookmark.
Definition navigation_checkpoint.hpp:48
std::size_t maxEntryBytes
Maximum provider payload for one location.
Definition navigation_checkpoint.hpp:46
Provider-issued durable identity; not a path inferred by the checkpoint library.
Definition navigation_checkpoint.hpp:52
std::string_view resource
Nonempty portable resource key including compatible lineage qualification.
Definition navigation_checkpoint.hpp:55
std::string_view name
Nonempty provider codec identifier, stable for its declared schema.
Definition navigation_checkpoint.hpp:53
std::uint32_t version
Positive codec schema version.
Definition navigation_checkpoint.hpp:54