Function holochain::core::workflow::call_zome_workflow::call_zome_workflow
source · pub async fn call_zome_workflow<Ribosome>(
workspace: SourceChainWorkspace,
network: HolochainP2pDna,
keystore: MetaLairClient,
args: CallZomeWorkflowArgs<Ribosome>,
trigger_publish_dht_ops: TriggerSender,
trigger_integrate_dht_ops: TriggerSender
) -> WorkflowResult<ZomeCallResult>where
Ribosome: RibosomeT + 'static,
Examples found in repository?
src/conductor/cell.rs (lines 877-884)
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887
pub async fn call_zome(
&self,
call: ZomeCall,
workspace_lock: Option<SourceChainWorkspace>,
) -> CellResult<ZomeCallResult> {
// Only check if init has run if this call is not coming from
// an already running init call.
if workspace_lock
.as_ref()
.map_or(true, |w| !w.called_from_init())
{
// Check if init has run if not run it
self.check_or_run_zome_init().await?;
}
let keystore = self.conductor_api.keystore().clone();
let conductor_handle = self.conductor_handle.clone();
let signal_tx = self.signal_broadcaster();
let ribosome = self.get_ribosome()?;
let invocation =
ZomeCallInvocation::try_from_interface_call(self.conductor_api.clone(), call).await?;
let dna_def = ribosome.dna_def().as_content().clone();
// If there is no existing zome call then this is the root zome call
let is_root_zome_call = workspace_lock.is_none();
let workspace_lock = match workspace_lock {
Some(l) => l,
None => {
SourceChainWorkspace::new(
self.authored_db().clone(),
self.dht_db().clone(),
self.space.dht_query_cache.clone(),
self.cache().clone(),
keystore.clone(),
self.id.agent_pubkey().clone(),
Arc::new(dna_def),
)
.await?
}
};
let args = CallZomeWorkflowArgs {
cell_id: self.id.clone(),
ribosome,
invocation,
signal_tx,
conductor_handle,
is_root_zome_call,
};
Ok(call_zome_workflow(
workspace_lock,
self.holochain_p2p_cell.clone(),
keystore,
args,
self.queue_triggers.publish_dht_ops.clone(),
self.queue_triggers.integrate_dht_ops.clone(),
)
.await
.map_err(Box::new)?)
}