Trait cfg_traits::data::DataRegistry
source · pub trait DataRegistry<DataId, CollectionId> {
type Collection: DataCollection<DataId, Data = Self::Data>;
type Data;
// Required methods
fn get(
data_id: &DataId,
collection_id: &CollectionId
) -> Result<Self::Data, DispatchError>;
fn collection(
collection_id: &CollectionId
) -> Result<Self::Collection, DispatchError>;
fn register_id(
data_id: &DataId,
collection_id: &CollectionId
) -> DispatchResult;
fn unregister_id(
data_id: &DataId,
collection_id: &CollectionId
) -> DispatchResult;
}
Expand description
Abstraction that represents a storage where you can subscribe to data updates and collect them
Required Associated Types§
sourcetype Collection: DataCollection<DataId, Data = Self::Data>
type Collection: DataCollection<DataId, Data = Self::Data>
A collection of data
Required Methods§
sourcefn get(
data_id: &DataId,
collection_id: &CollectionId
) -> Result<Self::Data, DispatchError>
fn get( data_id: &DataId, collection_id: &CollectionId ) -> Result<Self::Data, DispatchError>
Return the last data value for a data id in a collection
sourcefn collection(
collection_id: &CollectionId
) -> Result<Self::Collection, DispatchError>
fn collection( collection_id: &CollectionId ) -> Result<Self::Collection, DispatchError>
Retrives a collection of data with all data associated to a collection id
sourcefn register_id(data_id: &DataId, collection_id: &CollectionId) -> DispatchResult
fn register_id(data_id: &DataId, collection_id: &CollectionId) -> DispatchResult
Start listening data changes for a data id in a collection id
sourcefn unregister_id(
data_id: &DataId,
collection_id: &CollectionId
) -> DispatchResult
fn unregister_id( data_id: &DataId, collection_id: &CollectionId ) -> DispatchResult
Start listening data changes for a data id in a collection id
Object Safety§
This trait is not object safe.