pub trait VersioningFactory {
    type Output;
    type Error;
    type Arguments;

    // Required methods
    fn get_component() -> MipComponent;
    fn get_versioning_store(&self) -> MipStore;
    fn create(
        &self,
        args: &Self::Arguments,
        strategy: FactoryStrategy,
    ) -> Result<Self::Output, Self::Error>;

    // Provided methods
    fn get_latest_component_version_at(
        &self,
        ts: MassaTime,
    ) -> Result<u32, FactoryError> { ... }
    fn get_all_active_component_versions(&self) -> Vec<u32> { ... }
    fn get_all_component_versions(&self) -> BTreeMap<u32, ComponentStateTypeId> { ... }
    fn get_component_version_with_strategy(
        &self,
        strategy: FactoryStrategy,
    ) -> Result<u32, FactoryError> { ... }
}
Expand description

Trait for Factory that create objects based on versioning store

Required Associated Types§

source

type Output

Factory will create only one object of a given type, so a FactoryAddress (impl VersioningFactory), will have type Output = Address

source

type Error

Error if object cannot be created (+ used for VersioningFactoryArgs)

source

type Arguments

Arguments struct in order to create Self::Output

Required Methods§

source

fn get_component() -> MipComponent

Return the MipComponent associated with return type (Output) e.g. if type Output = Address, should return MipComponent::Address

source

fn get_versioning_store(&self) -> MipStore

Access to the MipStore

source

fn create( &self, args: &Self::Arguments, strategy: FactoryStrategy, ) -> Result<Self::Output, Self::Error>

Create an object of type Self::Output

Provided Methods§

source

fn get_latest_component_version_at( &self, ts: MassaTime, ) -> Result<u32, FactoryError>

Get latest version at given timestamp (e.g. slot)

source

fn get_all_active_component_versions(&self) -> Vec<u32>

Get all versions in ‘Active state’ for the associated MipComponent

source

fn get_all_component_versions(&self) -> BTreeMap<u32, ComponentStateTypeId>

Get all versions (at any state) for the associated MipComponent

source

fn get_component_version_with_strategy( &self, strategy: FactoryStrategy, ) -> Result<u32, FactoryError>

Get the version the current component with the given strategy

Object Safety§

This trait is not object safe.

Implementors§