Struct mithril_common::chain_observer::FakeObserver
source · pub struct FakeObserver {
pub signers: RwLock<Vec<SignerWithStake>>,
pub current_time_point: RwLock<Option<TimePoint>>,
pub datums: RwLock<Vec<TxDatum>>,
pub current_era: RwLock<String>,
}
Expand description
A Fake ChainObserver for testing purpose using fixed data.
Fields§
§signers: RwLock<Vec<SignerWithStake>>
A list of SignerWithStake, used for get_current_stake_distribution.
current_time_point: RwLock<Option<TimePoint>>
A TimePoint, used by get_current_epoch
datums: RwLock<Vec<TxDatum>>
A list of TxDatum, used by get_current_datums
current_era: RwLock<String>
A Cardano era, used by get_current_era
Implementations§
source§impl FakeObserver
impl FakeObserver
sourcepub async fn next_epoch(&self) -> Option<Epoch>
pub async fn next_epoch(&self) -> Option<Epoch>
Increase by one the epoch of the current_time_point.
sourcepub async fn increase_block_number(&self, increment: u64) -> Option<BlockNumber>
pub async fn increase_block_number(&self, increment: u64) -> Option<BlockNumber>
Increase the block number of the current_time_point by the given increment.
sourcepub async fn decrease_block_number(&self, decrement: u64) -> Option<BlockNumber>
pub async fn decrease_block_number(&self, decrement: u64) -> Option<BlockNumber>
Decrease the block number of the current_time_point by the given decrement.
sourcepub async fn increase_slot_number(&self, increment: u64) -> Option<SlotNumber>
pub async fn increase_slot_number(&self, increment: u64) -> Option<SlotNumber>
Increase the slot number of the current_time_point by the given increment.
sourcepub async fn decrease_slot_number(&self, decrement: u64) -> Option<SlotNumber>
pub async fn decrease_slot_number(&self, decrement: u64) -> Option<SlotNumber>
Decrease the slot number of the current_time_point by the given decrement.
sourcepub async fn set_signers(&self, new_signers: Vec<SignerWithStake>)
pub async fn set_signers(&self, new_signers: Vec<SignerWithStake>)
Set the signers that will use to compute the result of get_current_stake_distribution.
sourcepub async fn set_current_time_point(
&self,
new_current_time_point: Option<TimePoint>,
)
pub async fn set_current_time_point( &self, new_current_time_point: Option<TimePoint>, )
Set the time point
sourcepub async fn set_datums(&self, new_datums: Vec<TxDatum>)
pub async fn set_datums(&self, new_datums: Vec<TxDatum>)
Set the datums that will use to compute the result of get_current_datums.
sourcepub async fn set_current_era(&self, new_current_era: String)
pub async fn set_current_era(&self, new_current_era: String)
Set the current Era get_current_era.
Trait Implementations§
source§impl ChainObserver for FakeObserver
impl ChainObserver for FakeObserver
source§fn get_current_datums<'life0, 'life1, 'async_trait>(
&'life0 self,
_address: &'life1 ChainAddress,
) -> Pin<Box<dyn Future<Output = Result<Vec<TxDatum>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_current_datums<'life0, 'life1, 'async_trait>(
&'life0 self,
_address: &'life1 ChainAddress,
) -> Pin<Box<dyn Future<Output = Result<Vec<TxDatum>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
source§fn get_current_era<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_current_era<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn get_current_epoch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Epoch>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_current_epoch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<Epoch>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn get_current_chain_point<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<ChainPoint>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_current_chain_point<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<ChainPoint>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn get_current_stake_distribution<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<StakeDistribution>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_current_stake_distribution<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<StakeDistribution>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn get_current_kes_period<'life0, 'life1, 'async_trait>(
&'life0 self,
_opcert: &'life1 OpCert,
) -> Pin<Box<dyn Future<Output = Result<Option<KESPeriod>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_current_kes_period<'life0, 'life1, 'async_trait>(
&'life0 self,
_opcert: &'life1 OpCert,
) -> Pin<Box<dyn Future<Output = Result<Option<KESPeriod>, ChainObserverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !Freeze for FakeObserver
impl !RefUnwindSafe for FakeObserver
impl Send for FakeObserver
impl Sync for FakeObserver
impl Unpin for FakeObserver
impl !UnwindSafe for FakeObserver
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more