pub trait IndexOps<Proprietor, Pallet>where
Pallet: LazyBalance<Asset = <Pallet as InspectAsset<Proprietor>>::Asset, Variant = Pallet::Position, Id = Pallet::Digest> + IndexVariant<Proprietor>,{
// Required methods
fn remove_index_entry(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
entry_of: &Pallet::Digest,
) -> Result<Pallet::Digest, DispatchError>;
fn set_index_entry(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
entry_of: &Pallet::Digest,
shares: Pallet::Shares,
variant: &Pallet::Position,
) -> Result<Pallet::Digest, DispatchError>;
}Expand description
Defines operational behavior for managing indexed digests within a commitment system.
An IndexOps implementation extends IndexVariant to provide concrete
management logic for a proprietor’s indexed commitments, where an index acts
as a container of discrete digest entries.
Unlike pools (which aggregate balances collectively), indexes represent structured groupings of digests that can be individually set or removed, allowing for fine-grained commit management.
This trait defines low-level, unchecked operations - callers are responsible for ensuring validity and equilibrium before invoking these functions.
§Generics
- Proprietor - the entity (e.g. account, vault, or manager) controlling the asset.
- Pallet - the public struct implementing
Commitmenttraits andLazyBalance, ensuring consistent asset accounting across the commitment system.
Required Methods§
Sourcefn remove_index_entry(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
entry_of: &Pallet::Digest,
) -> Result<Pallet::Digest, DispatchError>
fn remove_index_entry( who: &Proprietor, reason: &Pallet::Reason, index_of: &Pallet::Digest, entry_of: &Pallet::Digest, ) -> Result<Pallet::Digest, DispatchError>
Removes a digest entry from an index for the given proprietor and reason.
Since indexes are immutable, this operation creates a new index without the specified entry and generates a new digest for it. The caller is responsible for managing the lifecycle of the old index digest.
This is a low-level, unchecked operation - callers must ensure equilibrium and invariant safety before calling.
§Returns
Ok(Digest)containing the new index digest after entry removalErr(DispatchError)if the operation fails
Sourcefn set_index_entry(
who: &Proprietor,
reason: &Pallet::Reason,
index_of: &Pallet::Digest,
entry_of: &Pallet::Digest,
shares: Pallet::Shares,
variant: &Pallet::Position,
) -> Result<Pallet::Digest, DispatchError>
fn set_index_entry( who: &Proprietor, reason: &Pallet::Reason, index_of: &Pallet::Digest, entry_of: &Pallet::Digest, shares: Pallet::Shares, variant: &Pallet::Position, ) -> Result<Pallet::Digest, DispatchError>
Sets or updates a digest entry within an index and returns the new index digest.
Since indexes are immutable, this operation creates a new index with the updated entry configuration (shares and variant) and generates a new digest for it. If the entry exists, it is updated; otherwise, it is added.
This is a low-level, unchecked operation - callers must ensure equilibrium and invariant safety before calling.
§Returns
Ok(Digest)containing the new index digest after entry modificationErr(DispatchError)if the operation fails
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<T: Config<I>, I: 'static> IndexOps<<T as Config>::AccountId, Pallet<T, I>> for CommitHelpers<T, I>
Implementation of IndexOps for the pallet, defining how index entries
are queried, inserted, updated, or removed within a given index digest.
Each function operates on the index-entry composition layer - maintaining relationships between an index digest and its subordinate entry digests.