Skip to main content

Controller

Struct Controller 

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

Source

pub fn new(db: &'a S) -> Self

Source

pub fn actions(&self, cid: ContractId) -> ActionLog<'a, S>

Returns the ActionLog of the contract

Source

pub fn logs(&self, id: impl Into<Id>) -> Logger<'a, S>

Returns the Logger of the contract or agent

Source

pub fn ledger(&self) -> Ledger<'a, S>

Returns the Ledger

Source

pub fn messages(&self) -> SubscriptionHandler<'a, S>

Returns the [‘SubscriptionHandler’]

Source

pub fn contract_participants( &self, cid: &ContractId, ) -> Result<Option<Vec<Participant>>>

List of contract-participants

Source

pub fn contract_exists(&self, cid: &ContractId) -> Result<bool>

Returns true if the contract exists

Source

pub fn agent_exists(&self, aid: &AgentId) -> Result<bool>

Returns true if the contract exists

Source

pub fn contract_revoked(&self, cid: &ContractId) -> Result<bool>

Returns true if the contract has been revoked

Source

pub fn agent_revoked(&self, aid: &AgentId) -> Result<bool>

Returns true if the agent has been revoked

Source

pub fn contract_revoked_ts(&self, cid: &ContractId) -> Result<Option<u64>>

Returns the timestamp, when the contract has been revoked.

Source

pub fn agent_revoked_ts(&self, aid: &AgentId) -> Result<Option<u64>>

Returns the timestamp, when the agent has been revoked.

Source

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

Source

pub fn contract_info(&self, cid: &ContractId) -> Result<Option<Info>>

Returns the Info section of the contract

Source

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.

Source

pub fn agent_subs(&self, aid: &AgentId) -> Result<Vec<Topic>>

Source

pub fn contract_desc(&self, cid: &ContractId) -> Result<Option<Description>>

Returns the Description of the contract

Source

pub fn agent_desc(&self, aid: &AgentId) -> Result<Option<Description>>

Returns the Description of the agent

Source

pub fn contract_meta(&self, cid: &ContractId) -> Result<Option<Metadata>>

Returns the Metadata of the contract

Source

pub fn agent_meta(&self, aid: &AgentId) -> Result<Option<Metadata>>

Returns the Metadata of the agent

Source

pub fn contract_full(&self, cid: &ContractId) -> Result<Option<ContractInfo>>

Returns the full ContractInfo, which bundles info, description and metadata.

Source

pub fn agent_full(&self, aid: &AgentId) -> Result<Option<AgentInfo>>

Returns the full AgentInfo, which bundles info, description and metadata.

Source

pub fn contract_revocation( &self, cid: &ContractId, ) -> Result<Option<Revocation>>

Returns the Revocation of the contract, if any.

Source

pub fn agent_revocation(&self, aid: &AgentId) -> Result<Option<Revocation>>

Returns the Revocation of the contract, if any.

Source

pub fn query_action(&self, tx_id: &TxIdentifier) -> Result<Option<ActionRecord>>

Queries an ActionRecord based on the TxIdentifier

Source

pub fn agent_pkg_def(&self, aid: &AgentId) -> Result<Option<WasmPkgNoSource>>

Returns the package definition for an agent

Source

pub fn agent_pkg_source(&self, aid: &AgentId) -> Result<Option<Source>>

Returns the package definition for an agent

Source

pub fn agent_pkg_full(&self, aid: &AgentId) -> Result<Option<WasmPkg>>

Returns the package definition for an agent

Source

pub fn contract_pkg_def( &self, aid: &ContractId, ) -> Result<Option<WasmPkgNoSource>>

Returns the package definition for an contract

Source

pub fn contract_pkg_source(&self, aid: &ContractId) -> Result<Option<Source>>

Returns the package definition for an contract

Source

pub fn contract_pkg_full(&self, aid: &ContractId) -> Result<Option<WasmPkg>>

Returns the package definition for an contract

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. 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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

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

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

Source§

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