Trait cfg_traits::changes::ChangeGuard
source · pub trait ChangeGuard {
type PoolId;
type ChangeId;
type Change;
// Required methods
fn note(
pool_id: Self::PoolId,
change: Self::Change
) -> Result<Self::ChangeId, DispatchError>;
fn released(
pool_id: Self::PoolId,
change_id: Self::ChangeId
) -> Result<Self::Change, DispatchError>;
}
Expand description
Trait for get feedback before apply certain changes. It can be used when you need to ask to a third party or external module if applying a change that has some effect into the system is something healthy.
Required Associated Types§
Required Methods§
sourcefn note(
pool_id: Self::PoolId,
change: Self::Change
) -> Result<Self::ChangeId, DispatchError>
fn note( pool_id: Self::PoolId, change: Self::Change ) -> Result<Self::ChangeId, DispatchError>
Notify a change
related to a pool_id
.
The caller to this method ask for feedback for the implementation of
this trait in order be able to semantically proceed successful with that
change. The change intention will be noted by this method and identified
by the returned ChangeId.
sourcefn released(
pool_id: Self::PoolId,
change_id: Self::ChangeId
) -> Result<Self::Change, DispatchError>
fn released( pool_id: Self::PoolId, change_id: Self::ChangeId ) -> Result<Self::Change, DispatchError>
Ask for a change_id
if it’s ready to proceed.
An error will be returned if:
- The change not exists.
- The change is not ready to be applied yet. The conditions not fulfilled.
- The change was already released.
- The change has expired.
If
Ok()
, the caller can proceed.
Object Safety§
This trait is not object safe.