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
emitted_log_source.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <cstdint>
5#include <string_view>
6#include <vector>
7
8#include <asio.hpp>
9
10#include "evm.hpp" // evm::EVM::EmittedLogRecord
11#include "events_ingest.hpp" // FinalityHeights
12
13namespace dcn::events
14{
15 // Result of a single poll against an attached log source: the new records,
16 // the source's own finality view (EmittedLogRecord carries none), and the
17 // cursor to resume from next poll.
19 {
20 std::vector<evm::EVM::EmittedLogRecord> records;
22 std::uint64_t next_cursor = 0;
23 };
24
25 // An attachable source of EmittedLogRecord batches for event ingestion.
26 // Each source owns exactly one chain_id. Ingestion drives the source (pull):
27 // it repeatedly calls pollSince() with the persisted cursor. RPC providers,
28 // the local EVM, archives, etc. all plug in behind this interface.
30 {
31 public:
32 virtual ~IEmittedLogSource() = default;
33
34 virtual int chainId() const = 0;
35
36 // Namespace prefix for feed ids / cursors produced from this source's
37 // events. Defaults to the in-process EVM namespace; remote sources
38 // must override (e.g. "eth" for a mainnet RPC source).
39 virtual std::string_view chainNamespace() const { return "local"; }
40
41 // When true, ingestion rewrites decoded entity addresses to the
42 // ephemeral sentinel for this source's events (local EVM policy).
43 virtual bool ephemeralEntities() const { return false; }
44
45 virtual asio::awaitable<SourcePoll> pollSince(std::uint64_t cursor, std::size_t limit) = 0;
46
47 virtual asio::awaitable<void> stop() { co_return; }
48 };
49}
Definition emitted_log_source.hpp:30
virtual int chainId() const =0
virtual ~IEmittedLogSource()=default
virtual std::string_view chainNamespace() const
Definition emitted_log_source.hpp:39
virtual asio::awaitable< SourcePoll > pollSince(std::uint64_t cursor, std::size_t limit)=0
virtual bool ephemeralEntities() const
Definition emitted_log_source.hpp:43
virtual asio::awaitable< void > stop()
Definition emitted_log_source.hpp:47
Definition decoded_event.hpp:11
Definition events_ingest.hpp:12
Definition emitted_log_source.hpp:19
FinalityHeights finality
Definition emitted_log_source.hpp:21
std::vector< evm::EVM::EmittedLogRecord > records
Definition emitted_log_source.hpp:20
std::uint64_t next_cursor
Definition emitted_log_source.hpp:22