Trait rgbstd::persistence::Inventory
source · pub trait Inventory: Deref<Target = Self::Stash> {
type Stash: Stash;
type Error: Error;
Show 27 methods
// Required methods
fn stash(&self) -> &Self::Stash;
fn import_sigs<I>(
&mut self,
content_id: ContentId,
sigs: I
) -> Result<(), InventoryDataError<Self::Error>>
where I: IntoIterator<Item = Cert>,
I::IntoIter: ExactSizeIterator<Item = Cert>;
fn import_schema(
&mut self,
schema: impl Into<Bindle<SubSchema>>
) -> Result<Status, InventoryDataError<Self::Error>>;
fn import_iface(
&mut self,
iface: impl Into<Bindle<Iface>>
) -> Result<Status, InventoryDataError<Self::Error>>;
fn import_iface_impl(
&mut self,
iimpl: impl Into<Bindle<IfaceImpl>>
) -> Result<Status, InventoryDataError<Self::Error>>;
fn import_contract<R: ResolveHeight>(
&mut self,
contract: Contract,
resolver: &mut R
) -> Result<Status, InventoryError<Self::Error>>
where R::Error: 'static;
fn accept_transfer<R: ResolveHeight>(
&mut self,
transfer: Transfer,
resolver: &mut R,
force: bool
) -> Result<Status, InventoryError<Self::Error>>
where R::Error: 'static;
fn consume_anchor(
&mut self,
anchor: Anchor<MerkleBlock>
) -> Result<(), InventoryError<Self::Error>>;
fn consume_bundle(
&mut self,
contract_id: ContractId,
bundle: TransitionBundle,
witness_txid: Txid
) -> Result<(), InventoryError<Self::Error>>;
unsafe fn import_contract_force<R: ResolveHeight>(
&mut self,
contract: Contract,
resolver: &mut R
) -> Result<Status, InventoryError<Self::Error>>
where R::Error: 'static;
fn contract_iface(
&mut self,
contract_id: ContractId,
iface_id: IfaceId
) -> Result<ContractIface, InventoryError<Self::Error>>;
fn anchored_bundle(
&self,
opid: OpId
) -> Result<AnchoredBundle, InventoryError<Self::Error>>;
fn transition(
&self,
opid: OpId
) -> Result<&Transition, InventoryError<Self::Error>>;
fn contracts_by_outpoints(
&mut self,
outpoints: impl IntoIterator<Item = impl Into<Outpoint>>
) -> Result<BTreeSet<ContractId>, InventoryError<Self::Error>>;
fn public_opouts(
&mut self,
contract_id: ContractId
) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>;
fn opouts_by_outpoints(
&mut self,
contract_id: ContractId,
outpoints: impl IntoIterator<Item = impl Into<Outpoint>>
) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>;
fn opouts_by_terminals(
&mut self,
terminals: impl IntoIterator<Item = SecretSeal>
) -> Result<BTreeSet<Opout>, InventoryError<Self::Error>>;
fn state_for_outpoints(
&mut self,
contract_id: ContractId,
outpoints: impl IntoIterator<Item = impl Into<Outpoint>>
) -> Result<BTreeMap<Opout, TypedState>, InventoryError<Self::Error>>;
fn store_seal_secret(
&mut self,
seal: GraphSeal
) -> Result<(), InventoryError<Self::Error>>;
fn seal_secrets(
&mut self
) -> Result<BTreeSet<GraphSeal>, InventoryError<Self::Error>>;
// Provided methods
fn contracts_with_iface(
&mut self,
iface: impl Into<TypeName>
) -> Result<Vec<ContractIface>, InventoryError<Self::Error>>
where Self::Error: From<<Self::Stash as Stash>::Error>,
InventoryError<Self::Error>: From<<Self::Stash as Stash>::Error> { ... }
fn contract_iface_named(
&mut self,
contract_id: ContractId,
iface: impl Into<TypeName>
) -> Result<ContractIface, InventoryError<Self::Error>>
where Self::Error: From<<Self::Stash as Stash>::Error>,
InventoryError<Self::Error>: From<<Self::Stash as Stash>::Error> { ... }
fn transition_builder(
&mut self,
contract_id: ContractId,
iface: impl Into<TypeName>,
transition_name: Option<impl Into<TypeName>>
) -> Result<TransitionBuilder, InventoryError<Self::Error>>
where Self::Error: From<<Self::Stash as Stash>::Error> { ... }
fn blank_builder(
&mut self,
contract_id: ContractId,
iface: impl Into<TypeName>
) -> Result<TransitionBuilder, InventoryError<Self::Error>>
where Self::Error: From<<Self::Stash as Stash>::Error> { ... }
fn export_contract(
&mut self,
contract_id: ContractId
) -> Result<Bindle<Contract>, ConsignerError<Self::Error, <<Self as Deref>::Target as Stash>::Error>> { ... }
fn transfer(
&mut self,
contract_id: ContractId,
seals: impl IntoIterator<Item = impl Into<BuilderSeal<SingleBlindSeal>>>
) -> Result<Bindle<Transfer>, ConsignerError<Self::Error, <<Self as Deref>::Target as Stash>::Error>> { ... }
fn consign<Seal: ExposedSeal, const TYPE: bool>(
&mut self,
contract_id: ContractId,
seals: impl IntoIterator<Item = impl Into<BuilderSeal<Seal>>>
) -> Result<Consignment<TYPE>, ConsignerError<Self::Error, <<Self as Deref>::Target as Stash>::Error>> { ... }
}Required Associated Types§
Required Methods§
fn stash(&self) -> &Self::Stash
fn import_sigs<I>( &mut self, content_id: ContentId, sigs: I ) -> Result<(), InventoryDataError<Self::Error>>where I: IntoIterator<Item = Cert>, I::IntoIter: ExactSizeIterator<Item = Cert>,
fn import_schema( &mut self, schema: impl Into<Bindle<SubSchema>> ) -> Result<Status, InventoryDataError<Self::Error>>
fn import_iface( &mut self, iface: impl Into<Bindle<Iface>> ) -> Result<Status, InventoryDataError<Self::Error>>
fn import_iface_impl( &mut self, iimpl: impl Into<Bindle<IfaceImpl>> ) -> Result<Status, InventoryDataError<Self::Error>>
fn import_contract<R: ResolveHeight>( &mut self, contract: Contract, resolver: &mut R ) -> Result<Status, InventoryError<Self::Error>>where R::Error: 'static,
fn accept_transfer<R: ResolveHeight>( &mut self, transfer: Transfer, resolver: &mut R, force: bool ) -> Result<Status, InventoryError<Self::Error>>where R::Error: 'static,
sourcefn consume_anchor(
&mut self,
anchor: Anchor<MerkleBlock>
) -> Result<(), InventoryError<Self::Error>>
fn consume_anchor( &mut self, anchor: Anchor<MerkleBlock> ) -> Result<(), InventoryError<Self::Error>>
Safety
Assumes that the bundle belongs to a non-mined witness transaction. Must be used only to consume locally-produced bundles before witness transactions are mined.
sourcefn consume_bundle(
&mut self,
contract_id: ContractId,
bundle: TransitionBundle,
witness_txid: Txid
) -> Result<(), InventoryError<Self::Error>>
fn consume_bundle( &mut self, contract_id: ContractId, bundle: TransitionBundle, witness_txid: Txid ) -> Result<(), InventoryError<Self::Error>>
Safety
Assumes that the bundle belongs to a non-mined witness transaction. Must be used only to consume locally-produced bundles before witness transactions are mined.
sourceunsafe fn import_contract_force<R: ResolveHeight>(
&mut self,
contract: Contract,
resolver: &mut R
) -> Result<Status, InventoryError<Self::Error>>where
R::Error: 'static,
unsafe fn import_contract_force<R: ResolveHeight>( &mut self, contract: Contract, resolver: &mut R ) -> Result<Status, InventoryError<Self::Error>>where R::Error: 'static,
Safety
Calling this method may lead to including into the stash asset information which may be invalid.