Trait rgb::stash::Stash[][src]

pub trait Stash {
    type Error: Error;
    type GenesisIterator: Iterator<Item = Genesis>;
    type AnchorIterator: Iterator<Item = Anchor>;
    type TransitionIterator: Iterator<Item = Transition>;
    type ExtensionIterator: Iterator<Item = Extension>;
    type NidIterator: Iterator<Item = NodeId>;
Show methods fn get_schema(&self, schema_id: SchemaId) -> Result<SchemaId, Self::Error>;
fn get_genesis(
        &self,
        contract_id: ContractId
    ) -> Result<Genesis, Self::Error>;
fn get_transition(&self, node_id: NodeId) -> Result<Transition, Self::Error>;
fn get_extension(&self, node_id: NodeId) -> Result<Extension, Self::Error>;
fn get_anchor(&self, anchor_id: ContractId) -> Result<Anchor, Self::Error>;
fn genesis_iter(&self) -> Self::GenesisIterator;
fn anchor_iter(&self) -> Self::AnchorIterator;
fn transition_iter(&self) -> Self::TransitionIterator;
fn extension_iter(&self) -> Self::ExtensionIterator;
fn consign(
        &self,
        contract_id: ContractId,
        node: &impl Node,
        anchor: Option<&Anchor>,
        endpoints: &BTreeSet<SealEndpoint>
    ) -> Result<Consignment, Self::Error>;
fn accept(
        &mut self,
        consignment: &Consignment,
        known_seals: &Vec<OutpointReveal>
    ) -> Result<(), Self::Error>;
fn know_about(&mut self, disclosure: Disclosure) -> Result<(), Self::Error>;
fn forget(&mut self, consignment: Consignment) -> Result<usize, Self::Error>;
fn prune(&mut self) -> Result<usize, Self::Error>;
}
Expand description

Top-level structure used by client wallets to manage all known RGB smart contracts and related data.

Stash operates blobs, so it does not keep in the memory whole copy of all data. Access to the underlying data structures happens through iterators:

  • [Stash::ContractIterator]

Associated Types

type Error: Error[src]

Expand description

Error type returned by different stash functions

type GenesisIterator: Iterator<Item = Genesis>[src]

type AnchorIterator: Iterator<Item = Anchor>[src]

type TransitionIterator: Iterator<Item = Transition>[src]

type ExtensionIterator: Iterator<Item = Extension>[src]

type NidIterator: Iterator<Item = NodeId>[src]

Loading content...

Required methods

fn get_schema(&self, schema_id: SchemaId) -> Result<SchemaId, Self::Error>[src]

fn get_genesis(&self, contract_id: ContractId) -> Result<Genesis, Self::Error>[src]

fn get_transition(&self, node_id: NodeId) -> Result<Transition, Self::Error>[src]

fn get_extension(&self, node_id: NodeId) -> Result<Extension, Self::Error>[src]

fn get_anchor(&self, anchor_id: ContractId) -> Result<Anchor, Self::Error>[src]

fn genesis_iter(&self) -> Self::GenesisIterator[src]

Expand description

A contract is a genesis

fn anchor_iter(&self) -> Self::AnchorIterator[src]

Expand description

We have to keep anchors at this level, since they may link many state transitions under multiple contracts at the same time (via LNPBP-4 multimessage commitments)

fn transition_iter(&self) -> Self::TransitionIterator[src]

fn extension_iter(&self) -> Self::ExtensionIterator[src]

fn consign(
    &self,
    contract_id: ContractId,
    node: &impl Node,
    anchor: Option<&Anchor>,
    endpoints: &BTreeSet<SealEndpoint>
) -> Result<Consignment, Self::Error>
[src]

Expand description

When we need to send over to somebody else an update (like we have transferred him some state, for instance an asset) for each transfer we ask Stash to create a new Consignment for the given set of seals (endpoints) under some specific ContractId, starting from a graph vertex node. If the node is state transition, we must also include anchor information.

fn accept(
    &mut self,
    consignment: &Consignment,
    known_seals: &Vec<OutpointReveal>
) -> Result<(), Self::Error>
[src]

Expand description

When we have received data from other peer (which usually relate to our newly owned state, like assets) we do accept a Consignment, and it gets into the known data.

fn know_about(&mut self, disclosure: Disclosure) -> Result<(), Self::Error>[src]

Expand description

Acquire knowledge from a given disclosure

fn forget(&mut self, consignment: Consignment) -> Result<usize, Self::Error>[src]

Expand description

If we need to forget about the state which is not owned by us anymore (we have done the transfer and would like to prune this specific info) we call this function

fn prune(&mut self) -> Result<usize, Self::Error>[src]

Expand description

Clears all data that are not related to the contract state owned by us in this moment — under all known contracts

Loading content...

Implementors

Loading content...