pub struct AttentionEventId(/* private fields */);Expand description
Stable identity of one projected reason to look at a ceremony.
Derived from the record that produced it, so replaying the feed after a restart produces the same identity and the ledger recognises the item it already holds instead of delivering it twice.
Implementations§
Source§impl AttentionEventId
impl AttentionEventId
Sourcepub fn new(raw: impl Into<String>) -> Result<Self, DomainError>
pub fn new(raw: impl Into<String>) -> Result<Self, DomainError>
Validate an identifier read back from storage or a host payload.
Sourcepub fn derive(
ceremony_id: &CeremonyId,
position: GlobalPosition,
source_event_id: &str,
kind: AttentionKind,
) -> Result<Self, DomainError>
pub fn derive( ceremony_id: &CeremonyId, position: GlobalPosition, source_event_id: &str, kind: AttentionKind, ) -> Result<Self, DomainError>
The identity the projection deduplicates on.
The position is in it because the ledger holds identities and the loop has to hand a host the event itself. Carrying where the record sits turns that into one bounded read at a known position, instead of a scan for an event id the store has no index for. It is as stable as the rest: a record’s place in the global order does not move, so replaying the feed still derives the same identity.
Sourcepub fn source_position(
&self,
ceremony_id: &CeremonyId,
) -> Option<GlobalPosition>
pub fn source_position( &self, ceremony_id: &CeremonyId, ) -> Option<GlobalPosition>
Where in the global feed the record behind this sits.
The ceremony has to be supplied because a ceremony identifier
may itself contain a colon, so the prefix is known rather than
guessed. None means the identity was not derived by this
build — an identifier read back from a host, say — and the
caller has to go and look the ordinary way.