Skip to main content

Change

Struct Change 

Source
pub struct Change { /* private fields */ }
Expand description

One acdp-change/1 entry (RFC-ACDP-0018 §4), CLOSED.

Built only through Self::from_value / Deserialize (which enforce the schema, including each carried object’s own closed schema) or the registry-side constructors Self::lifecycle, Self::superseded and Self::key_revocation (which derive recorded_at and the ids from the evidence, so they cannot disagree with it).

Parsing does not verify anything: see Self::check_consistency for the pure cross-checks, and acdp-client’s verify_change for §7.

Implementations§

Source§

impl Change

Source

pub fn from_value(value: &Value) -> Result<Self, AcdpError>

Parse a change entry from wire JSON, enforcing the closed schema. Failures are AcdpError::SchemaViolation.

Source

pub fn lifecycle( seq: u64, lineage_id: LineageId, agent_id: AgentDid, raw_event: Value, event_receipt: &EventReceipt, ) -> Result<Self, AcdpError>

A lifecycle entry for the event at event_receipt.index of the receipt’s context. raw_event is the stored event, verbatim; recorded_at is the receipt’s accepted_at.

Source

pub fn superseded( seq: u64, ctx_id: CtxId, agent_id: AgentDid, registry_receipt: &RegistryReceipt, ) -> Result<Self, AcdpError>

A superseded entry: ctx_id was superseded by the version registry_receipt was minted for. The lineage is the receipt’s; agent_id is the superseded context’s producer.

Source

pub fn key_revocation( seq: u64, agent_id: AgentDid, registry_receipt: &RegistryReceipt, ) -> Result<Self, AcdpError>

A key_revocation entry for the revocation context registry_receipt was minted for. agent_id is the revoked key’s controller: metadata.revoked_key_controller when present, else the revocation body’s agent_id (RFC-ACDP-0018 §4).

Source

pub fn seq(&self) -> u64

The entry’s sequence number (§5.3).

Source

pub fn kind(&self) -> ChangeKind

The entry’s kind.

Source

pub fn ctx_id(&self) -> &CtxId

The affected context.

Source

pub fn lineage_id(&self) -> &LineageId

The affected context’s lineage.

Source

pub fn agent_id(&self) -> &AgentDid

The producer whose reliance the change touches (§4).

Source

pub fn recorded_at(&self) -> DateTime<Utc>

The registry’s clock at commit.

Source

pub fn evidence(&self) -> &ChangeEvidence

The evidence, by kind.

Source

pub fn check_consistency(&self) -> Result<(), AcdpError>

The pure cross-checks between an entry’s envelope and its evidence (RFC-ACDP-0018 §4), run before any network round-trip:

  • lifecycle: the event’s and the receipt’s ctx_id are the entry’s; recorded_at equals event_receipt.accepted_at.
  • superseded: the receipt is for superseded_by (not the entry’s own context) in the entry’s lineage; recorded_at equals registry_receipt.created_at.
  • key_revocation: the receipt is for the entry’s context and lineage; recorded_at equals registry_receipt.created_at.

Signatures and the receipt’s binding to the event are NOT checked here. Failures are AcdpError::SchemaViolation.

Trait Implementations§

Source§

impl Clone for Change

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Change

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Change

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Change

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Change

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Change

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.