pub struct DomainRecord {
pub reference: DomainRecordRef,
pub owner: String,
pub class: DomainRecordClass,
pub version: u64,
pub lifecycle: DomainRecordLifecycle,
pub payload: Value,
pub references: Vec<DomainReference>,
}Fields§
§reference: DomainRecordRef§owner: String§class: DomainRecordClass§version: u64§lifecycle: DomainRecordLifecycle§payload: Value§references: Vec<DomainReference>Implementations§
Source§impl DomainRecord
impl DomainRecord
pub const fn is_deleted(&self) -> bool
Sourcepub const fn is_active(&self) -> bool
pub const fn is_active(&self) -> bool
Examples found in repository?
examples/governance_transition.rs (line 398)
366fn audit_order(
367 view: &SimulationView<'_>,
368 context: &BoundaryContext,
369) -> Result<BoundaryProposal, CanwuError> {
370 if owned_order_ingress(view, context, CENTRAL_PLUGIN, ISSUE_INGRESS)?.is_some() {
371 return Ok(BoundaryProposal::default());
372 }
373 let order = order_payload(view)?;
374 for (label, reference, expected_plugin, expected_system) in [
375 (
376 "treasury",
377 treasury_reference().as_untyped(),
378 TREASURY_PLUGIN,
379 "prepare-treasury",
380 ),
381 (
382 "county",
383 county_reference().as_untyped(),
384 COUNTY_PLUGIN,
385 "prepare-county",
386 ),
387 ] {
388 let record = view.domain_record(reference)?.ok_or_else(|| {
389 CanwuError::new(
390 ErrorCode::InvalidBoundary,
391 format!("central audit is missing the {label} relief disposition"),
392 )
393 })?;
394 let expected_hash = action_hash(600)?;
395 validate_order(&order, expected_system, expected_plugin, &expected_hash)?;
396 let actual_hash = canonical_hash(ACTION_HASH_DOMAIN, &record.payload)?;
397 if record.version != 1
398 || !record.is_active()
399 || record.owner != expected_plugin
400 || actual_hash != expected_hash
401 || record.payload != json!({"status": "committed", "grain_units": 600})
402 {
403 return Err(CanwuError::new(
404 ErrorCode::InvalidBoundary,
405 format!("central audit found an invalid {label} disposition"),
406 ));
407 }
408 }
409 Ok(BoundaryProposal::default())
410}pub fn typed_reference<T>(&self) -> Option<TypedDomainRecordRef<T>>where
T: DomainRecordType,
Sourcepub fn decode_payload<T>(
&self,
) -> Result<<T as DomainRecordType>::Payload, CanwuError>
pub fn decode_payload<T>( &self, ) -> Result<<T as DomainRecordType>::Payload, CanwuError>
Trait Implementations§
Source§impl Clone for DomainRecord
impl Clone for DomainRecord
Source§fn clone(&self) -> DomainRecord
fn clone(&self) -> DomainRecord
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DomainRecord
impl Debug for DomainRecord
Source§impl<'de> Deserialize<'de> for DomainRecord
impl<'de> Deserialize<'de> for DomainRecord
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DomainRecord, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DomainRecord, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for DomainRecord
impl PartialEq for DomainRecord
Source§impl Serialize for DomainRecord
impl Serialize for DomainRecord
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DomainRecord
Auto Trait Implementations§
impl Freeze for DomainRecord
impl RefUnwindSafe for DomainRecord
impl Send for DomainRecord
impl Sync for DomainRecord
impl Unpin for DomainRecord
impl UnsafeUnpin for DomainRecord
impl UnwindSafe for DomainRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more