pub struct System<V>where
V: SystemCallbackObject,{
pub versioned_system_logic: SystemVersion,
pub callback: V,
pub blueprint_cache: NonIterMap<CanonicalBlueprintId, Rc<BlueprintDefinition>>,
pub schema_cache: NonIterMap<SchemaHash, Rc<VersionedSchema<ScryptoCustomSchema>>>,
pub auth_cache: NonIterMap<CanonicalBlueprintId, AuthConfig>,
pub modules: SystemModuleMixer,
pub finalization: SystemFinalization,
}
Fields§
§versioned_system_logic: SystemVersion
§callback: V
§blueprint_cache: NonIterMap<CanonicalBlueprintId, Rc<BlueprintDefinition>>
§schema_cache: NonIterMap<SchemaHash, Rc<VersionedSchema<ScryptoCustomSchema>>>
§auth_cache: NonIterMap<CanonicalBlueprintId, AuthConfig>
§modules: SystemModuleMixer
§finalization: SystemFinalization
Implementations§
Source§impl<V> System<V>where
V: SystemCallbackObject,
impl<V> System<V>where
V: SystemCallbackObject,
pub fn new( versioned_system_logic: SystemVersion, callback: V, modules: SystemModuleMixer, finalization: SystemFinalization, ) -> System<V>
Trait Implementations§
Source§impl<V> HasModules for System<V>where
V: SystemCallbackObject,
impl<V> HasModules for System<V>where
V: SystemCallbackObject,
fn modules_mut(&mut self) -> &mut SystemModuleMixer
Source§impl<V> KernelCallbackObject for System<V>where
V: SystemCallbackObject,
impl<V> KernelCallbackObject for System<V>where
V: SystemCallbackObject,
Source§type LockData = SystemLockData
type LockData = SystemLockData
Data to be stored with each substate lock
Source§type CallFrameData = Actor
type CallFrameData = Actor
Data to be stored with every call frame
Source§fn on_pin_node<Y>(node_id: &NodeId, api: &mut Y) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_pin_node<Y>(node_id: &NodeId, api: &mut Y) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before a node is pinned to the heap
Source§fn on_create_node<Y>(
event: CreateNodeEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_create_node<Y>(
event: CreateNodeEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callbacks before/on-io-access/after a new node is created
Source§fn on_drop_node<Y>(
event: DropNodeEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_drop_node<Y>(
event: DropNodeEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callbacks before/on-io-access/after a node is dropped
Source§fn on_move_module<Y>(
event: MoveModuleEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_move_module<Y>(
event: MoveModuleEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback when a module is moved
Source§fn on_open_substate<Y>(
event: OpenSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_open_substate<Y>(
event: OpenSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before/on-io-access/after a substate is opened
Source§fn on_close_substate<Y>(
event: CloseSubstateEvent,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_close_substate<Y>(
event: CloseSubstateEvent,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before a substate is closed
Source§fn on_read_substate<Y>(
event: ReadSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_read_substate<Y>(
event: ReadSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before a substate is read
Source§fn on_write_substate<Y>(
event: WriteSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_write_substate<Y>(
event: WriteSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before a substate is written to
Source§fn on_set_substate<Y>(
event: SetSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_set_substate<Y>(
event: SetSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before/on-io-access a substate is set
Source§fn on_remove_substate<Y>(
event: RemoveSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_remove_substate<Y>(
event: RemoveSubstateEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before/on-io-access a substate is removed
Source§fn on_scan_keys<Y>(
event: ScanKeysEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_scan_keys<Y>(
event: ScanKeysEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before/on-io-access a key scan occurs
Source§fn on_drain_substates<Y>(
event: DrainSubstatesEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_drain_substates<Y>(
event: DrainSubstatesEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before/on-io-access a substate drain occurs
Source§fn on_scan_sorted_substates<Y>(
event: ScanSortedSubstatesEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_scan_sorted_substates<Y>(
event: ScanSortedSubstatesEvent<'_>,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before/on-io-access a sorted substate scan occurs
Source§fn before_invoke<Y>(
invocation: &KernelInvocation<Actor>,
api: &mut Y,
) -> Result<(), RuntimeError>
fn before_invoke<Y>( invocation: &KernelInvocation<Actor>, api: &mut Y, ) -> Result<(), RuntimeError>
Callback before an invocation and a new call frame is created
Source§fn on_execution_start<Y>(api: &mut Y) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_execution_start<Y>(api: &mut Y) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback after a new call frame is created for a new invocation
Source§fn invoke_upstream<Y>(
input: &IndexedScryptoValue,
api: &mut Y,
) -> Result<IndexedScryptoValue, RuntimeError>
fn invoke_upstream<Y>( input: &IndexedScryptoValue, api: &mut Y, ) -> Result<IndexedScryptoValue, RuntimeError>
Callback on invocation. This is where the callback object should execute application logic.
Source§fn auto_drop<Y>(nodes: Vec<NodeId>, api: &mut Y) -> Result<(), RuntimeError>
fn auto_drop<Y>(nodes: Vec<NodeId>, api: &mut Y) -> Result<(), RuntimeError>
Callback after invocation during call frame cleanup and nodes are still owned by the executed
call frame
Source§fn on_execution_finish<Y>(
message: &CallFrameMessage,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_execution_finish<Y>(
message: &CallFrameMessage,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback right after execution of invocation and where call of execution still exists
fn on_get_stack_id<Y>(api: &mut Y) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_switch_stack<Y>(api: &mut Y) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_send_to_stack<Y>(
value: &IndexedScryptoValue,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_set_call_frame_data<Y>(
data: &<System<V> as KernelCallbackObject>::CallFrameData,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_get_owned_nodes<Y>(api: &mut Y) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Source§fn after_invoke<Y>(
output: &IndexedScryptoValue,
api: &mut Y,
) -> Result<(), RuntimeError>
fn after_invoke<Y>( output: &IndexedScryptoValue, api: &mut Y, ) -> Result<(), RuntimeError>
Callback after an invocation and where invocation’s call frame has already been destroyed
Source§fn on_allocate_node_id<Y>(
entity_type: EntityType,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_allocate_node_id<Y>(
entity_type: EntityType,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before node id allocation
Source§fn on_mark_substate_as_transient<Y>(
node_id: &NodeId,
partition_number: &PartitionNumber,
substate_key: &SubstateKey,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
fn on_mark_substate_as_transient<Y>(
node_id: &NodeId,
partition_number: &PartitionNumber,
substate_key: &SubstateKey,
api: &mut Y,
) -> Result<(), RuntimeError>where
Y: KernelInternalApi<System = System<V>>,
Callback before a substate is marked as transient
Source§fn on_substate_lock_fault<Y>(
node_id: NodeId,
partition_num: PartitionNumber,
offset: &SubstateKey,
api: &mut Y,
) -> Result<bool, RuntimeError>
fn on_substate_lock_fault<Y>( node_id: NodeId, partition_num: PartitionNumber, offset: &SubstateKey, api: &mut Y, ) -> Result<bool, RuntimeError>
Callback when a substate does not exist
Source§fn on_drop_node_mut<Y>(
node_id: &NodeId,
api: &mut Y,
) -> Result<(), RuntimeError>
fn on_drop_node_mut<Y>( node_id: &NodeId, api: &mut Y, ) -> Result<(), RuntimeError>
Callback before a node is dropped
Source§impl<V> KernelTransactionExecutor for System<V>where
V: SystemCallbackObject,
impl<V> KernelTransactionExecutor for System<V>where
V: SystemCallbackObject,
Source§type Init = SystemInit<<V as SystemCallbackObject>::Init>
type Init = SystemInit<<V as SystemCallbackObject>::Init>
Initialization object
Source§type Executable = ExecutableTransaction
type Executable = ExecutableTransaction
The transaction object
Source§type ExecutionOutput = Vec<InstructionOutput>
type ExecutionOutput = Vec<InstructionOutput>
Output to be returned at the end of execution
Source§type Receipt = TransactionReceipt
type Receipt = TransactionReceipt
Final receipt to be created after transaction execution
Source§fn init(
store: &mut impl CommitableSubstateStore,
executable: &ExecutableTransaction,
init_input: <System<V> as KernelTransactionExecutor>::Init,
always_visible_global_nodes: &'static IndexSet<NodeId>,
) -> Result<(System<V>, Vec<CallFrameInit<Actor>>), <System<V> as KernelTransactionExecutor>::Receipt>
fn init( store: &mut impl CommitableSubstateStore, executable: &ExecutableTransaction, init_input: <System<V> as KernelTransactionExecutor>::Init, always_visible_global_nodes: &'static IndexSet<NodeId>, ) -> Result<(System<V>, Vec<CallFrameInit<Actor>>), <System<V> as KernelTransactionExecutor>::Receipt>
Create the callback object (system layer) and the initial call frame configuration for each intent
Source§fn execute<Y>(
api: &mut Y,
executable: &ExecutableTransaction,
) -> Result<Vec<InstructionOutput>, RuntimeError>where
Y: SystemBasedKernelApi,
fn execute<Y>(
api: &mut Y,
executable: &ExecutableTransaction,
) -> Result<Vec<InstructionOutput>, RuntimeError>where
Y: SystemBasedKernelApi,
Start execution
Source§fn finalize(
&mut self,
executable: &ExecutableTransaction,
info: Vec<StoreCommit>,
) -> Result<(), RuntimeError>
fn finalize( &mut self, executable: &ExecutableTransaction, info: Vec<StoreCommit>, ) -> Result<(), RuntimeError>
Finish execution
Source§fn create_receipt<S>(
self,
track: MappedTrack<'_, S, SpreadPrefixKeyMapper>,
interpretation_result: Result<Vec<InstructionOutput>, TransactionExecutionError>,
) -> TransactionReceiptwhere
S: SubstateDatabase,
fn create_receipt<S>(
self,
track: MappedTrack<'_, S, SpreadPrefixKeyMapper>,
interpretation_result: Result<Vec<InstructionOutput>, TransactionExecutionError>,
) -> TransactionReceiptwhere
S: SubstateDatabase,
Create final receipt
Auto Trait Implementations§
impl<V> Freeze for System<V>where
V: Freeze,
impl<V> !RefUnwindSafe for System<V>
impl<V> !Send for System<V>
impl<V> !Sync for System<V>
impl<V> Unpin for System<V>where
V: Unpin,
impl<V> !UnwindSafe for System<V>
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
Source§impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
type Error = <U as ContextualTryFrom<T>>::Error
type Context = <U as ContextualTryFrom<T>>::Context
fn contextual_try_into( self, context: &<U as ContextualTryFrom<T>>::Context, ) -> Result<U, <U as ContextualTryFrom<T>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn 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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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
.Source§fn as_any(&self) -> &(dyn Any + 'static)
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.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more