pub struct RealRibosome {
    pub dna_file: DnaFile,
    pub zome_types: Arc<GlobalZomeTypes>,
    pub zome_dependencies: Arc<HashMap<ZomeName, Vec<ZomeIndex>>>,
}
Expand description

The only RealRibosome is a Wasm ribosome. note that this is cloned on every invocation so keep clones cheap!

Fields§

§dna_file: DnaFile§zome_types: Arc<GlobalZomeTypes>

Entry and link types for each integrity zome.

§zome_dependencies: Arc<HashMap<ZomeName, Vec<ZomeIndex>>>

Dependencies for every zome.

Implementations§

source§

impl RealRibosome

source

pub fn new(dna_file: DnaFile) -> RibosomeResult<Self>

Create a new instance

source

pub fn precompiled_module( &self, dylib_path: &PathBuf ) -> RibosomeResult<Arc<Module>>

source

pub fn runtime_compiled_module( &self, zome_name: &ZomeName ) -> RibosomeResult<Arc<Module>>

source

pub fn wasm_cache_key(&self, zome_name: &ZomeName) -> Result<[u8; 32], DnaError>

source

pub fn cache_instance( &self, context_key: u64, instance: Arc<Mutex<Instance>>, zome_name: &ZomeName ) -> RibosomeResult<()>

source

pub fn build_instance( &self, zome: &Zome<ZomeDef>, context_key: u64 ) -> RibosomeResult<Arc<Mutex<Instance>>>

source

pub fn instance( &self, call_context: CallContext ) -> RibosomeResult<(Arc<Mutex<Instance>>, u64)>

source

pub async fn tooling_imports() -> RibosomeResult<Vec<String>>

source

pub fn get_zome_dependencies( &self, zome_name: &ZomeName ) -> RibosomeResult<&[ZomeIndex]>

source

pub fn do_wasm_call_for_module<I: Invocation>( &self, call_context: CallContext, invocation: &I, zome: &Zome, to_call: &FunctionName, module: Arc<Module> ) -> Result<Option<ExternIO>, RibosomeError>

source

pub fn get_const_fn_for_wasm( &self, call_context: CallContext, name: &str, module: Arc<Module> ) -> Result<Option<i32>, RibosomeError>

source

pub fn get_extern_fns_for_wasm(&self, module: Arc<Module>) -> Vec<FunctionName>

Trait Implementations§

source§

impl Clone for RealRibosome

source§

fn clone(&self) -> RealRibosome

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for RealRibosome

source§

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

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

impl RibosomeT for RealRibosome

source§

fn maybe_call<I: Invocation>( &self, host_context: HostContext, invocation: &I, zome: &Zome, to_call: &FunctionName ) -> Result<Option<ExternIO>, RibosomeError>

call a function in a zome for an invocation if it exists if it does not exist then return Ok(None)

source§

fn call_zome_function( &self, host_access: ZomeCallHostAccess, invocation: ZomeCallInvocation ) -> RibosomeResult<ZomeCallResponse>

Runs the specified zome fn. Returns the cursor used by HDK, so that it can be passed on to source chain manager for transactional writes

source§

fn run_post_commit( &self, host_access: PostCommitHostAccess, invocation: PostCommitInvocation ) -> RibosomeResult<()>

Post commit works a bit different to the other callbacks. As it is dispatched from a spawned task there is nothing to handle any result, good or bad, other than to maybe log some error.

source§

fn dna_def(&self) -> &DnaDefHashed

source§

fn zome_info(&self, zome: Zome) -> RibosomeResult<ZomeInfo>

source§

fn get_const_fn( &self, zome: &Zome, name: &str ) -> Result<Option<i32>, RibosomeError>

Get a value from a const wasm function. Read more
source§

fn call_iterator<I: Invocation>( &self, host_context: HostContext, invocation: I ) -> CallIterator<Self, I>

source§

fn run_genesis_self_check( &self, host_access: GenesisSelfCheckHostAccess, invocation: GenesisSelfCheckInvocation ) -> RibosomeResult<GenesisSelfCheckResult>

source§

fn run_validate( &self, host_access: ValidateHostAccess, invocation: ValidateInvocation ) -> RibosomeResult<ValidateResult>

Helper function for running a validation callback. Calls private fn do_callback! under the hood.
source§

fn run_init( &self, host_access: InitHostAccess, invocation: InitInvocation ) -> RibosomeResult<InitResult>

source§

fn run_entry_defs( &self, host_access: EntryDefsHostAccess, invocation: EntryDefsInvocation ) -> RibosomeResult<EntryDefsResult>

source§

fn run_migrate_agent( &self, host_access: MigrateAgentHostAccess, invocation: MigrateAgentInvocation ) -> RibosomeResult<MigrateAgentResult>

source§

fn zome_types(&self) -> &Arc<GlobalZomeTypes>

source§

fn dna_hash(&self) -> &DnaHash

source§

fn dna_file(&self) -> &DnaFile

source§

fn get_integrity_zome(&self, zome_index: &ZomeIndex) -> Option<IntegrityZome>

source§

fn zomes_to_invoke(&self, zomes_to_invoke: ZomesToInvoke) -> Vec<Zome>

source§

fn zome_name_to_id(&self, zome_name: &ZomeName) -> RibosomeResult<ZomeIndex>

source§

fn list_callbacks(&self)

@todo list out all the available callbacks and maybe cache them somewhere
source§

fn list_zome_fns(&self)

@todo list out all the available zome functions and maybe cache them somewhere

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
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more