pub struct Controller<'a, S: Db> { /* private fields */ }Expand description
Model-controller to retrieve information about a contract from the key-value storage.
Implementations§
Source§impl<'a, S: Db> Controller<'a, S>
impl<'a, S: Db> Controller<'a, S>
pub fn new(db: &'a S) -> Self
Sourcepub fn actions(&self, cid: ContractId) -> ActionLog<'a, S>
pub fn actions(&self, cid: ContractId) -> ActionLog<'a, S>
Returns the ActionLog of the contract
Sourcepub fn logs(&self, id: impl Into<Id>) -> Logger<'a, S>
pub fn logs(&self, id: impl Into<Id>) -> Logger<'a, S>
Returns the Logger of the contract or agent
Sourcepub fn messages(&self) -> SubscriptionHandler<'a, S>
pub fn messages(&self) -> SubscriptionHandler<'a, S>
Returns the [‘SubscriptionHandler’]
Sourcepub fn contract_participants(
&self,
cid: &ContractId,
) -> Result<Option<Vec<Participant>>>
pub fn contract_participants( &self, cid: &ContractId, ) -> Result<Option<Vec<Participant>>>
List of contract-participants
Sourcepub fn contract_exists(&self, cid: &ContractId) -> Result<bool>
pub fn contract_exists(&self, cid: &ContractId) -> Result<bool>
Returns true if the contract exists
Sourcepub fn agent_exists(&self, aid: &AgentId) -> Result<bool>
pub fn agent_exists(&self, aid: &AgentId) -> Result<bool>
Returns true if the contract exists
Sourcepub fn contract_revoked(&self, cid: &ContractId) -> Result<bool>
pub fn contract_revoked(&self, cid: &ContractId) -> Result<bool>
Returns true if the contract has been revoked
Sourcepub fn agent_revoked(&self, aid: &AgentId) -> Result<bool>
pub fn agent_revoked(&self, aid: &AgentId) -> Result<bool>
Returns true if the agent has been revoked
Sourcepub fn contract_revoked_ts(&self, cid: &ContractId) -> Result<Option<u64>>
pub fn contract_revoked_ts(&self, cid: &ContractId) -> Result<Option<u64>>
Returns the timestamp, when the contract has been revoked.
Sourcepub fn agent_revoked_ts(&self, aid: &AgentId) -> Result<Option<u64>>
pub fn agent_revoked_ts(&self, aid: &AgentId) -> Result<Option<u64>>
Returns the timestamp, when the agent has been revoked.
Sourcepub fn contract_last_tx_hash(&self, cid: &ContractId) -> Result<Option<Hash256>>
pub fn contract_last_tx_hash(&self, cid: &ContractId) -> Result<Option<Hash256>>
Returns the hash of the last-tx that was executed by the contract
Sourcepub fn contract_info(&self, cid: &ContractId) -> Result<Option<Info>>
pub fn contract_info(&self, cid: &ContractId) -> Result<Option<Info>>
Returns the Info section of the contract
Sourcepub fn agent_sinks(&self, aid: &AgentId) -> Result<Option<Vec<Sink>>>
pub fn agent_sinks(&self, aid: &AgentId) -> Result<Option<Vec<Sink>>>
Returns the sinks for an agent
Since an agent has no participants of roles, the sinks and the agent-id are the only two things
that are left from the Info struct.
pub fn agent_subs(&self, aid: &AgentId) -> Result<Vec<Topic>>
Sourcepub fn contract_desc(&self, cid: &ContractId) -> Result<Option<Description>>
pub fn contract_desc(&self, cid: &ContractId) -> Result<Option<Description>>
Returns the Description of the contract
Sourcepub fn agent_desc(&self, aid: &AgentId) -> Result<Option<Description>>
pub fn agent_desc(&self, aid: &AgentId) -> Result<Option<Description>>
Returns the Description of the agent
Sourcepub fn contract_meta(&self, cid: &ContractId) -> Result<Option<Metadata>>
pub fn contract_meta(&self, cid: &ContractId) -> Result<Option<Metadata>>
Returns the Metadata of the contract
Sourcepub fn agent_meta(&self, aid: &AgentId) -> Result<Option<Metadata>>
pub fn agent_meta(&self, aid: &AgentId) -> Result<Option<Metadata>>
Returns the Metadata of the agent
Sourcepub fn contract_full(&self, cid: &ContractId) -> Result<Option<ContractInfo>>
pub fn contract_full(&self, cid: &ContractId) -> Result<Option<ContractInfo>>
Returns the full ContractInfo, which bundles info, description and metadata.
Sourcepub fn agent_full(&self, aid: &AgentId) -> Result<Option<AgentInfo>>
pub fn agent_full(&self, aid: &AgentId) -> Result<Option<AgentInfo>>
Returns the full AgentInfo, which bundles info, description and metadata.
Sourcepub fn contract_revocation(
&self,
cid: &ContractId,
) -> Result<Option<Revocation>>
pub fn contract_revocation( &self, cid: &ContractId, ) -> Result<Option<Revocation>>
Returns the Revocation of the contract, if any.
Sourcepub fn agent_revocation(&self, aid: &AgentId) -> Result<Option<Revocation>>
pub fn agent_revocation(&self, aid: &AgentId) -> Result<Option<Revocation>>
Returns the Revocation of the contract, if any.
Sourcepub fn query_action(&self, tx_id: &TxIdentifier) -> Result<Option<ActionRecord>>
pub fn query_action(&self, tx_id: &TxIdentifier) -> Result<Option<ActionRecord>>
Queries an ActionRecord based on the TxIdentifier
Sourcepub fn agent_pkg_def(&self, aid: &AgentId) -> Result<Option<WasmPkgNoSource>>
pub fn agent_pkg_def(&self, aid: &AgentId) -> Result<Option<WasmPkgNoSource>>
Returns the package definition for an agent
Sourcepub fn agent_pkg_source(&self, aid: &AgentId) -> Result<Option<Source>>
pub fn agent_pkg_source(&self, aid: &AgentId) -> Result<Option<Source>>
Returns the package definition for an agent
Sourcepub fn agent_pkg_full(&self, aid: &AgentId) -> Result<Option<WasmPkg>>
pub fn agent_pkg_full(&self, aid: &AgentId) -> Result<Option<WasmPkg>>
Returns the package definition for an agent
Sourcepub fn contract_pkg_def(
&self,
aid: &ContractId,
) -> Result<Option<WasmPkgNoSource>>
pub fn contract_pkg_def( &self, aid: &ContractId, ) -> Result<Option<WasmPkgNoSource>>
Returns the package definition for an contract
Sourcepub fn contract_pkg_source(&self, aid: &ContractId) -> Result<Option<Source>>
pub fn contract_pkg_source(&self, aid: &ContractId) -> Result<Option<Source>>
Returns the package definition for an contract
Sourcepub fn contract_pkg_full(&self, aid: &ContractId) -> Result<Option<WasmPkg>>
pub fn contract_pkg_full(&self, aid: &ContractId) -> Result<Option<WasmPkg>>
Returns the package definition for an contract
Sourcepub fn filter_events(&self, events: Events) -> Result<Events>
pub fn filter_events(&self, events: Events) -> Result<Events>
Filters a set of events, discarding those considered invalid
Events considered invalid are:
- [‘ContractCall’] targeting a non-existing SmartContract
- [‘ContractCall’] targeting a revoked SmartContract
- [‘Message’] with no subscribers
Returns a new [‘Events’] containing only the valid events
Auto Trait Implementations§
impl<'a, S> Freeze for Controller<'a, S>
impl<'a, S> RefUnwindSafe for Controller<'a, S>where
S: RefUnwindSafe,
impl<'a, S> Send for Controller<'a, S>
impl<'a, S> Sync for Controller<'a, S>
impl<'a, S> Unpin for Controller<'a, S>
impl<'a, S> UnsafeUnpin for Controller<'a, S>
impl<'a, S> UnwindSafe for Controller<'a, S>where
S: RefUnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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