pub struct MipStore(pub Arc<RwLock<MipStoreRaw>>);Expand description
Database for all MIP info
Tuple Fields§
§0: Arc<RwLock<MipStoreRaw>>Implementations§
Source§impl MipStore
impl MipStore
Sourcepub fn get_network_version_current(&self) -> u32
pub fn get_network_version_current(&self) -> u32
Retrieve the current network version, as the store’s state says right now.
This follows the store’s current state, which only reaches Active once
finality has processed the activation slot. Block headers must not use it:
see MipStore::get_network_version_active_at.
Sourcepub fn get_network_version_active_at(&self, ts: MassaTime) -> u32
pub fn get_network_version_active_at(&self, ts: MassaTime) -> u32
Retrieve the last active version at the given timestamp (e.g. a slot’s).
A MIP still LockedIn in this store counts as active at ts once
ts > locked_at + activation_delay. That is exactly when
LockedIn::on_advance activates it, and every node advances the store on
every final slot, so Active.at is always the first slot timestamp past
that instant. Answering from the instant rather than from the state means a
node whose finality has not yet reached the activation slot agrees with a
node that is already Active – and with the version the producer stamped –
for every slot. Otherwise the blocks produced during the finality lag carry
the old version, and any node that is already Active (e.g. one that just
bootstrapped) rejects them.
Requires activation_delay to exceed the finality lag, so that nodes know a
MIP is LockedIn before its activation instant (guaranteed on real networks by
VERSIONING_ACTIVATION_DELAY_MIN, one cycle).
Sourcepub fn get_network_version_to_announce_at(&self, ts: MassaTime) -> Option<u32>
pub fn get_network_version_to_announce_at(&self, ts: MassaTime) -> Option<u32>
Retrieve the network version to announce in the header of a block at ts.
Same as MipStore::get_network_version_to_announce, except that a MIP
already active at ts (see MipStore::get_network_version_active_at) is
no longer announced: it is the header’s current version from then on, and
announcing it as well would make the header invalid.
Sourcepub fn get_network_version_to_announce(&self) -> Option<u32>
pub fn get_network_version_to_announce(&self) -> Option<u32>
Retrieve the network version number to announce in block header return 0 is there is nothing to announce
pub fn update_network_version_stats( &mut self, slot_timestamp: MassaTime, network_versions: Option<(u32, Option<u32>)>, )
pub fn update_with( &mut self, mip_store: &MipStore, ) -> Result<(Vec<MipInfo>, BTreeMap<MipInfo, MipState>), UpdateWithError>
Sourcepub fn get_latest_component_version_at(
&self,
component: &MipComponent,
ts: MassaTime,
) -> u32
pub fn get_latest_component_version_at( &self, component: &MipComponent, ts: MassaTime, ) -> u32
Get latest version at given timestamp (e.g. slot) for the given MipComponent.
Considers MIPs whose current store state is Active or LockedIn: the
LockedIn→Active transition is a pure function of (locked_in_at, activation_delay, ts), so a node still in LockedIn agrees with peers
that have already advanced to Active on whether ts is past activation.
state_at(ts) remains the gate that decides if the version applies at
ts (pre-activation queries while LockedIn still return the previous
version).
Sourcepub(crate) fn get_all_active_component_versions(
&self,
component: &MipComponent,
) -> Vec<u32>
pub(crate) fn get_all_active_component_versions( &self, component: &MipComponent, ) -> Vec<u32>
Get all versions in ‘Active state’ for the given MipComponent
Sourcepub(crate) fn get_all_component_versions(
&self,
component: &MipComponent,
) -> BTreeMap<u32, ComponentStateTypeId>
pub(crate) fn get_all_component_versions( &self, component: &MipComponent, ) -> BTreeMap<u32, ComponentStateTypeId>
Get all versions (at any state) for the given MipComponent
Sourcepub fn get_mip_status(&self) -> BTreeMap<MipInfo, ComponentStateTypeId>
pub fn get_mip_status(&self) -> BTreeMap<MipInfo, ComponentStateTypeId>
Retrieve a list of MIP info with their corresponding state (as id) - used for grpc API
pub fn is_consistent_with_shutdown_period( &self, shutdown_start: Slot, shutdown_end: Slot, thread_count: u8, t0: MassaTime, genesis_timestamp: MassaTime, ) -> Result<(), IsConsistentWithShutdownPeriodError>
pub fn update_for_network_shutdown( &mut self, shutdown_start: Slot, shutdown_end: Slot, thread_count: u8, t0: MassaTime, genesis_timestamp: MassaTime, ) -> Result<(), ModelsError>
pub fn is_key_value_valid( &self, serialized_key: &[u8], serialized_value: &[u8], ) -> bool
pub fn update_batches( &self, db_batch: &mut DBBatch, db_versioning_batch: &mut DBBatch, between: Option<(&MassaTime, &MassaTime)>, ) -> Result<(), SerializeError>
pub fn extend_from_db( &mut self, db: ShareableMassaDBController, ) -> Result<(Vec<MipInfo>, BTreeMap<MipInfo, MipState>), ExtendFromDbError>
Sourcepub fn started_mips_missing_from_db(
&self,
db: &ShareableMassaDBController,
at: MassaTime,
) -> Vec<MipInfo>
pub fn started_mips_missing_from_db( &self, db: &ShareableMassaDBController, at: MassaTime, ) -> Vec<MipInfo>
MIPs of this store that a bootstrap server’s streamed state (db) does not contain, and
whose start is at or before at, the timestamp of the bootstrapped final slot.
Such a server runs a release that predates the MIP, so it cannot provide the MIP’s state.
Accepting it would leave this node replaying the MIP from its compiled-in Defined state,
starting at its own first processed slot: the history it records (and, past lock-in, its
activation) would differ from the rest of the network’s, and once the MIP is Active that
history is part of the hashed final state. Before start nobody has recorded anything for
the MIP yet, so replaying it locally is deterministic and such a server is still usable.
pub fn reset_db(&self, db: ShareableMassaDBController)
Sourcepub fn try_from_db(
db: ShareableMassaDBController,
cfg: MipStatsConfig,
) -> Result<Self, ExtendFromDbError>
pub fn try_from_db( db: ShareableMassaDBController, cfg: MipStatsConfig, ) -> Result<Self, ExtendFromDbError>
Create a MIP store with what is written on the disk
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MipStore
impl !RefUnwindSafe for MipStore
impl Send for MipStore
impl Sync for MipStore
impl Unpin for MipStore
impl !UnwindSafe for MipStore
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.