pub struct SystemService<'a, Y, V>{
    pub api: &'a mut Y,
    pub phantom: PhantomData<V>,
}
Expand description

Provided to upper layer for invoking lower layer service

Fields§

§api: &'a mut Y§phantom: PhantomData<V>

Implementations§

source§

impl<'a, Y, V> SystemService<'a, Y, V>

source

pub fn new(api: &'a mut Y) -> SystemService<'a, Y, V>

source§

impl<'a, Y, V> SystemService<'a, Y, V>

source§

impl<'a, Y, V> SystemService<'a, Y, V>

source

pub fn validate_bp_generic_args( &mut self, blueprint_interface: &BlueprintInterface, schemas: &IndexMap<SchemaHash, VersionedSchema<ScryptoCustomSchema>>, generic_substitutions: &Vec<GenericSubstitution> ) -> Result<(), TypeCheckError>

Validate that the type substitutions match the generic definition of a given blueprint

source

pub fn validate_kv_store_generic_args( &mut self, schemas: &IndexMap<SchemaHash, VersionedSchema<ScryptoCustomSchema>>, key: &GenericSubstitution, value: &GenericSubstitution ) -> Result<(), TypeCheckError>

Validate that the type substitutions for a kv store exist in a given schema

source

pub fn get_payload_schema( &mut self, target: &BlueprintTypeTarget, payload_identifier: &BlueprintPayloadIdentifier ) -> Result<(Rc<VersionedSchema<ScryptoCustomSchema>>, LocalTypeId, bool, bool, SchemaOrigin), RuntimeError>

source

pub fn validate_blueprint_payload( &mut self, target: &BlueprintTypeTarget, payload_identifier: BlueprintPayloadIdentifier, payload: &[u8] ) -> Result<(), RuntimeError>

Validate that a blueprint payload matches the blueprint’s definition of that payload

source

pub fn validate_blueprint_kv_collection( &mut self, target: &BlueprintTypeTarget, collection_index: u8, payloads: &[(&Vec<u8>, &Vec<u8>)] ) -> Result<PartitionDescription, RuntimeError>

Validate that a blueprint kv collection payloads match the blueprint’s definition

source

pub fn validate_kv_store_payload( &mut self, target: &KVStoreTypeTarget, payload_identifier: KeyOrValue, payload: &[u8] ) -> Result<(), RuntimeError>

Validate that a key value payload matches the key value store’s definition of that payload

source

pub fn get_blueprint_type_schema( &mut self, type_id: &BlueprintTypeIdentifier ) -> Result<(Rc<VersionedSchema<ScryptoCustomSchema>>, ScopedTypeId), RuntimeError>

Trait Implementations§

source§

impl<'a, Y, V> ClientActorApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn actor_get_blueprint_id(&mut self) -> Result<BlueprintId, RuntimeError>

Retrieve the current blueprint id
source§

fn actor_get_node_id(&mut self, ref_handle: u32) -> Result<NodeId, RuntimeError>

Retrieve the current method actor’s node id
source§

fn actor_is_feature_enabled( &mut self, object_handle: u32, feature: &str ) -> Result<bool, RuntimeError>

Check if a feature is enabled for a given object
source§

fn actor_open_field( &mut self, object_handle: u32, field_index: u8, flags: LockFlags ) -> Result<u32, RuntimeError>

Open a field in a given object for reading/writing
source§

fn actor_emit_event( &mut self, event_name: String, event_data: Vec<u8>, event_flags: EventFlags ) -> Result<(), RuntimeError>

Emits an event of the current actor
source§

impl<'a, Y, V> ClientActorIndexApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn actor_index_insert( &mut self, object_handle: u32, collection_index: u8, key: Vec<u8>, buffer: Vec<u8> ) -> Result<(), RuntimeError>

Inserts an entry into an index
source§

fn actor_index_remove( &mut self, object_handle: u32, collection_index: u8, key: Vec<u8> ) -> Result<Option<Vec<u8>>, RuntimeError>

Removes an entry from an index
source§

fn actor_index_scan_keys( &mut self, object_handle: u32, collection_index: u8, limit: u32 ) -> Result<Vec<Vec<u8>>, RuntimeError>

Scans arbitrary elements of count from an index
source§

fn actor_index_drain( &mut self, object_handle: u32, collection_index: u8, limit: u32 ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, RuntimeError>

Removes and returns arbitrary elements of count from an index
source§

fn actor_index_insert_typed<K, V>( &mut self, object_handle: u32, collection_index: u8, key: K, value: V ) -> Result<(), E>

Inserts an entry into an index
source§

fn actor_index_remove_typed<V>( &mut self, object_handle: u32, collection_index: u8, key: Vec<u8> ) -> Result<Option<V>, E>
where V: ScryptoDecode,

Removes an entry from an index
source§

fn actor_index_scan_keys_typed<K>( &mut self, object_handle: u32, collection_index: u8, limit: u32 ) -> Result<Vec<K>, E>
where K: ScryptoDecode,

Scans arbitrary elements of count from an index
source§

fn actor_index_drain_typed<K, V>( &mut self, object_handle: u32, collection_index: u8, limit: u32 ) -> Result<Vec<(K, V)>, E>

Removes and returns arbitrary elements of count from an index
source§

impl<'a, Y, V> ClientActorKeyValueEntryApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn actor_open_key_value_entry( &mut self, object_handle: u32, collection_index: u8, key: &Vec<u8>, flags: LockFlags ) -> Result<u32, RuntimeError>

If the key value entry doesn’t exist, it uses the default “Option::None”
source§

fn actor_remove_key_value_entry( &mut self, object_handle: u32, collection_index: u8, key: &Vec<u8> ) -> Result<Vec<u8>, RuntimeError>

source§

fn actor_remove_key_value_entry_typed<V>( &mut self, object_handle: u32, collection_index: u8, key: &Vec<u8> ) -> Result<Option<V>, E>
where V: ScryptoDecode,

source§

impl<'a, Y, V> ClientActorSortedIndexApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn actor_sorted_index_insert( &mut self, object_handle: u32, collection_index: u8, sorted_key: ([u8; 2], Vec<u8>), buffer: Vec<u8> ) -> Result<(), RuntimeError>

Inserts an entry into a sorted index
source§

fn actor_sorted_index_remove( &mut self, object_handle: u32, collection_index: u8, sorted_key: &([u8; 2], Vec<u8>) ) -> Result<Option<Vec<u8>>, RuntimeError>

Removes an entry from a sorted index
source§

fn actor_sorted_index_scan( &mut self, object_handle: u32, collection_index: u8, limit: u32 ) -> Result<Vec<(([u8; 2], Vec<u8>), Vec<u8>)>, RuntimeError>

Scans the first elements of count from a sorted index
source§

fn actor_sorted_index_insert_typed<V>( &mut self, object_handle: u32, collection_index: u8, sorted_key: ([u8; 2], Vec<u8>), value: V ) -> Result<(), E>
where V: ScryptoEncode,

Inserts an entry into a sorted index
source§

fn actor_sorted_index_remove_typed<V>( &mut self, object_handle: u32, collection_index: u8, sorted_key: &([u8; 2], Vec<u8>) ) -> Result<Option<V>, E>
where V: ScryptoDecode,

Removes an entry from a sorted index
source§

fn actor_sorted_index_scan_typed<K, V>( &mut self, object_handle: u32, collection_index: u8, count: u32 ) -> Result<Vec<(K, V)>, E>

Scans the first elements of count from a sorted index
source§

impl<'a, Y, V> ClientBlueprintApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn call_function( &mut self, package_address: PackageAddress, blueprint_name: &str, function_name: &str, args: Vec<u8> ) -> Result<Vec<u8>, RuntimeError>

Calls a function on a blueprint
source§

fn resolve_blueprint_type( &mut self, blueprint_type_id: &BlueprintTypeIdentifier ) -> Result<(Rc<VersionedSchema<ScryptoCustomSchema>>, ScopedTypeId), RuntimeError>

source§

impl<'a, Y, V> ClientCostingApi<RuntimeError> for SystemService<'a, Y, V>

source§

impl<'a, Y, V> ClientCryptoUtilsApi<RuntimeError> for SystemService<'a, Y, V>

source§

impl<'a, Y, V> ClientExecutionTraceApi<RuntimeError> for SystemService<'a, Y, V>

source§

impl<'a, Y, V> ClientFieldApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn field_read(&mut self, handle: u32) -> Result<Vec<u8>, RuntimeError>

source§

fn field_write( &mut self, handle: u32, buffer: Vec<u8> ) -> Result<(), RuntimeError>

source§

fn field_lock(&mut self, handle: u32) -> Result<(), RuntimeError>

source§

fn field_close(&mut self, handle: u32) -> Result<(), RuntimeError>

source§

fn field_read_typed<S>(&mut self, handle: u32) -> Result<S, E>
where S: ScryptoDecode,

source§

fn field_write_typed<S>(&mut self, handle: u32, substate: &S) -> Result<(), E>
where S: ScryptoEncode,

source§

impl<'a, Y, V> ClientKeyValueEntryApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn key_value_entry_get(&mut self, handle: u32) -> Result<Vec<u8>, RuntimeError>

source§

fn key_value_entry_lock(&mut self, handle: u32) -> Result<(), RuntimeError>

source§

fn key_value_entry_remove( &mut self, handle: u32 ) -> Result<Vec<u8>, RuntimeError>

source§

fn key_value_entry_set( &mut self, handle: u32, buffer: Vec<u8> ) -> Result<(), RuntimeError>

source§

fn key_value_entry_close(&mut self, handle: u32) -> Result<(), RuntimeError>

source§

fn key_value_entry_get_typed<S>(&mut self, handle: u32) -> Result<Option<S>, E>
where S: ScryptoDecode,

source§

fn key_value_entry_set_typed<S>( &mut self, handle: u32, value: S ) -> Result<(), E>
where S: ScryptoEncode,

source§

impl<'a, Y, V> ClientKeyValueStoreApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn key_value_store_new( &mut self, data_schema: KeyValueStoreDataSchema ) -> Result<NodeId, RuntimeError>

Creates a new key value store with a given schema
source§

fn key_value_store_open_entry( &mut self, node_id: &NodeId, key: &Vec<u8>, flags: LockFlags ) -> Result<u32, RuntimeError>

Lock a key value store entry for reading/writing
source§

fn key_value_store_remove_entry( &mut self, node_id: &NodeId, key: &Vec<u8> ) -> Result<Vec<u8>, RuntimeError>

source§

impl<'a, Y, V> ClientObjectApi<RuntimeError> for SystemService<'a, Y, V>

source§

fn new_object( &mut self, blueprint_ident: &str, features: Vec<&str>, generic_args: GenericArgs, fields: IndexMap<u8, FieldValue>, kv_entries: IndexMap<u8, IndexMap<Vec<u8>, KVEntry>> ) -> Result<NodeId, RuntimeError>

Creates a new object of a given blueprint type
source§

fn allocate_global_address( &mut self, blueprint_id: BlueprintId ) -> Result<(GlobalAddressReservation, GlobalAddress), RuntimeError>

Pre-allocates a global address, for a future globalization.
source§

fn allocate_virtual_global_address( &mut self, blueprint_id: BlueprintId, global_address: GlobalAddress ) -> Result<GlobalAddressReservation, RuntimeError>

source§

fn globalize( &mut self, node_id: NodeId, modules: IndexMap<AttachedModuleId, NodeId>, address_reservation: Option<GlobalAddressReservation> ) -> Result<GlobalAddress, RuntimeError>

Moves an object currently in the heap into the global space making it accessible to all with the provided global address.
source§

fn globalize_with_address_and_create_inner_object_and_emit_event( &mut self, node_id: NodeId, modules: IndexMap<AttachedModuleId, NodeId>, address_reservation: GlobalAddressReservation, inner_object_blueprint: &str, inner_object_fields: IndexMap<u8, FieldValue>, event_name: &str, event_data: Vec<u8> ) -> Result<(GlobalAddress, NodeId), RuntimeError>

source§

fn call_method( &mut self, receiver: &NodeId, method_name: &str, args: Vec<u8> ) -> Result<Vec<u8>, RuntimeError>

Calls a method on an object
source§

fn call_direct_access_method( &mut self, receiver: &NodeId, method_name: &str, args: Vec<u8> ) -> Result<Vec<u8>, RuntimeError>

source§

fn call_module_method( &mut self, receiver: &NodeId, module_id: AttachedModuleId, method_name: &str, args: Vec<u8> ) -> Result<Vec<u8>, RuntimeError>

Calls a method on an object module
source§

fn get_blueprint_id( &mut self, node_id: &NodeId ) -> Result<BlueprintId, RuntimeError>

Get the blueprint id of a visible object
source§

fn get_outer_object( &mut self, node_id: &NodeId ) -> Result<GlobalAddress, RuntimeError>

Get the outer object of a visible object
source§

fn get_reservation_address( &mut self, node_id: &NodeId ) -> Result<GlobalAddress, RuntimeError>

source§

fn drop_object( &mut self, node_id: &NodeId ) -> Result<Vec<Vec<u8>>, RuntimeError>

Drops an owned object, returns the fields of the object
source§

fn new_simple_object( &mut self, blueprint_ident: &str, fields: IndexMap<u8, FieldValue> ) -> Result<NodeId, E>

Creates a new simple blueprint object of a given blueprint type
source§

impl<'a, Y, V> ClientTransactionRuntimeApi<RuntimeError> for SystemService<'a, Y, V>

source§

impl<'a, Y, V> KernelInternalApi<SystemConfig<V>> for SystemService<'a, Y, V>

source§

fn kernel_get_system_state(&mut self) -> SystemState<'_, SystemConfig<V>>

source§

fn kernel_get_current_depth(&self) -> usize

Gets the number of call frames that are currently in the call frame stack
source§

fn kernel_get_node_visibility(&self, node_id: &NodeId) -> NodeVisibility

Returns the visibility of a node
source§

fn kernel_read_bucket(&mut self, bucket_id: &NodeId) -> Option<BucketSnapshot>

source§

fn kernel_read_proof(&mut self, proof_id: &NodeId) -> Option<ProofSnapshot>

source§

fn kernel_get_system(&mut self) -> &mut M

Retrieves data associated with the kernel upstream layer (system)
source§

impl<'a, Y, V> KernelNodeApi for SystemService<'a, Y, V>

source§

fn kernel_pin_node(&mut self, node_id: NodeId) -> Result<(), RuntimeError>

Pin a node to it’s current device.
source§

fn kernel_drop_node( &mut self, node_id: &NodeId ) -> Result<DroppedNode, RuntimeError>

Removes an RENode. Owned children will be possessed by the call frame. Read more
source§

fn kernel_allocate_node_id( &mut self, entity_type: EntityType ) -> Result<NodeId, RuntimeError>

Allocates a new node id useable for create_node
source§

fn kernel_create_node( &mut self, node_id: NodeId, node_substates: BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>> ) -> Result<(), RuntimeError>

Creates a new RENode
source§

fn kernel_create_node_from( &mut self, node_id: NodeId, partitions: BTreeMap<PartitionNumber, (NodeId, PartitionNumber)> ) -> Result<(), RuntimeError>

source§

impl<'a, Y, V> KernelSubstateApi<SystemLockData> for SystemService<'a, Y, V>

source§

fn kernel_mark_substate_as_transient( &mut self, node_id: NodeId, partition_num: PartitionNumber, key: SubstateKey ) -> Result<(), RuntimeError>

Marks a substate as transient, or a substate which was never and will never be persisted
source§

fn kernel_open_substate_with_default<F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, flags: LockFlags, default: Option<F>, data: SystemLockData ) -> Result<u32, RuntimeError>

Locks a substate to make available for reading and/or writing
source§

fn kernel_get_lock_data( &mut self, lock_handle: u32 ) -> Result<SystemLockData, RuntimeError>

Retrieves info related to a lock
source§

fn kernel_close_substate( &mut self, lock_handle: u32 ) -> Result<(), RuntimeError>

Drops the handle on some substate, if the handle is a force write, updates are flushed. No updates should occur if an error is returned.
source§

fn kernel_read_substate( &mut self, lock_handle: u32 ) -> Result<&IndexedScryptoValue, RuntimeError>

Reads the value of the substate locked by the given lock handle
source§

fn kernel_write_substate( &mut self, lock_handle: u32, value: IndexedScryptoValue ) -> Result<(), RuntimeError>

Writes a value to the substate locked by the given lock handle
source§

fn kernel_set_substate( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: SubstateKey, value: IndexedScryptoValue ) -> Result<(), RuntimeError>

Sets a value to a substate without checking for the original value. Read more
source§

fn kernel_remove_substate( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey ) -> Result<Option<IndexedScryptoValue>, RuntimeError>

Removes a substate from a node and returns the original value. Read more
source§

fn kernel_scan_sorted_substates( &mut self, node_id: &NodeId, partition_num: PartitionNumber, limit: u32 ) -> Result<Vec<(([u8; 2], Vec<u8>), IndexedScryptoValue)>, RuntimeError>

Reads substates under a node in sorted lexicographical order Read more
source§

fn kernel_scan_keys<K>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, limit: u32 ) -> Result<Vec<SubstateKey>, RuntimeError>
where K: SubstateKeyContent + 'static,

source§

fn kernel_drain_substates<K>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, limit: u32 ) -> Result<Vec<(SubstateKey, IndexedScryptoValue)>, RuntimeError>
where K: SubstateKeyContent + 'static,

source§

fn kernel_open_substate( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, flags: LockFlags, lock_data: L ) -> Result<u32, RuntimeError>

source§

impl<'a, Y, V> ClientApi<RuntimeError> for SystemService<'a, Y, V>

Auto Trait Implementations§

§

impl<'a, Y, V> RefUnwindSafe for SystemService<'a, Y, V>

§

impl<'a, Y, V> Send for SystemService<'a, Y, V>
where V: Send, Y: Send,

§

impl<'a, Y, V> Sync for SystemService<'a, Y, V>
where V: Sync, Y: Sync,

§

impl<'a, Y, V> Unpin for SystemService<'a, Y, V>
where V: Unpin,

§

impl<'a, Y, V> !UnwindSafe for SystemService<'a, Y, V>

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<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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
§

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

§

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

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

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

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

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

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

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

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

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

§

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

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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.

§

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

impl<T> Same for T

§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V