Decentralised Art Server
High-performance C++ backend that exposes HTML interface and a secure REST API for managing Performative Transactions entities
Loading...
Searching...
No Matches
dcn::registry::RegistryProjector Class Referencefinal

Materialises finalised registry events from the hot-store changelog into the Registry database, using an independent change_seq cursor persisted in the registry DB. Implements events::IEventProjector so it can be driven by the existing EventsRuntime projection loop. More...

#include <registry_projector.hpp>

Inheritance diagram for dcn::registry::RegistryProjector:
dcn::events::IEventProjector

Public Member Functions

 RegistryProjector (events::SQLiteHotStore &store, Registry &registry, const asio::strand< asio::io_context::executor_type > &write_strand, events::ProjectorRetryConfig retry={})
std::string_view id () const override
std::int64_t cursor () const override
asio::awaitable< std::size_t > projectBatch (std::size_t limit, std::int64_t now_ms) override
Public Member Functions inherited from dcn::events::IEventProjector
virtual ~IEventProjector ()=default

Detailed Description

Materialises finalised registry events from the hot-store changelog into the Registry database, using an independent change_seq cursor persisted in the registry DB. Implements events::IEventProjector so it can be driven by the existing EventsRuntime projection loop.

Cursor policy:

  • cursor is loaded from the registry DB at construction and persisted after each batch (only if at least one row was consumed or skipped).
  • non-finalized rows (observed/safe/removed) are skipped; their change_seq is still advanced past because they will re-surface with a higher change_seq when they reach "finalized".

Failure policy (per _materializeOne):

  • success / already present → cursor advanced.
  • failure (undecodable log, divergence, add rejection) → cursor is left before the row and the row is retried on subsequent projectBatch passes, so transient failures (e.g. busy registry DB) heal on their own. After ProjectorRetryConfig::max_attempts consecutive failing passes the row is dead-lettered (REGISTRY_DEAD_LETTER_BIT in the hot store) and the cursor advances past it: a permanently parked cursor would freeze the prune watermark for every projector and grow the hot store without bound. Dead-lettered rows are exempt from pruning, so no chain event data is lost; a periodic idle-time sweep (ProjectorRetryConfig::sweep_interval_ms) retries them and clears the bit once materialization succeeds. If the dead-letter mark itself cannot be written, the cursor stays parked.

Constructor & Destructor Documentation

◆ RegistryProjector()

dcn::registry::RegistryProjector::RegistryProjector ( events::SQLiteHotStore & store,
Registry & registry,
const asio::strand< asio::io_context::executor_type > & write_strand,
events::ProjectorRetryConfig retry = {} )

Member Function Documentation

◆ cursor()

std::int64_t dcn::registry::RegistryProjector::cursor ( ) const
inlineoverridevirtual

◆ id()

std::string_view dcn::registry::RegistryProjector::id ( ) const
overridevirtual

◆ projectBatch()

asio::awaitable< std::size_t > dcn::registry::RegistryProjector::projectBatch ( std::size_t limit,
std::int64_t now_ms )
overridevirtual

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