Function holochain::core::check_entry_type
source · pub fn check_entry_type(
entry_type: &EntryType,
entry: &Entry
) -> SysValidationResult<()>
Expand description
Check the entry variant matches the variant in the actions entry type
Examples found in repository?
src/core/workflow/sys_validation_workflow.rs (line 618)
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
async fn store_entry(
action: NewEntryActionRef<'_>,
entry: &Entry,
conductor_handle: &Conductor,
workspace: &SysValidationWorkspace,
network: HolochainP2pDna,
) -> SysValidationResult<()> {
// Get data ready to validate
let entry_type = action.entry_type();
let entry_hash = action.entry_hash();
// Checks
check_entry_type(entry_type, entry)?;
if let EntryType::App(app_entry_def) = entry_type {
let entry_def =
check_app_entry_def(workspace.dna_hash(), app_entry_def, conductor_handle).await?;
check_not_private(&entry_def)?;
}
check_entry_hash(entry_hash, entry).await?;
check_entry_size(entry)?;
// Additional checks if this is an Update
if let NewEntryActionRef::Update(entry_update) = action {
let original_action_address = &entry_update.original_action_address;
let mut cascade = workspace.full_cascade(network);
let original_action = cascade
.retrieve_action(original_action_address.clone(), Default::default())
.await?
.ok_or_else(|| {
ValidationOutcome::DepMissingFromDht(original_action_address.clone().into())
})?;
update_check(entry_update, original_action.action())?;
}
// Additional checks if this is a countersigned entry.
if let Entry::CounterSign(session_data, _) = entry {
check_countersigning_session_data(EntryHash::with_data_sync(entry), session_data, action)
.await?;
}
Ok(())
}