pub struct ProposalCache<N: Network> { /* private fields */ }Expand description
A helper type for the cache of proposal and signed proposals.
Implementations§
Source§impl<N: Network> ProposalCache<N>
impl<N: Network> ProposalCache<N>
Sourcepub fn new(
latest_round: u64,
proposal: Option<Proposal<N>>,
signed_proposals: SignedProposals<N>,
pending_certificates: IndexSet<BatchCertificate<N>>,
) -> Self
pub fn new( latest_round: u64, proposal: Option<Proposal<N>>, signed_proposals: SignedProposals<N>, pending_certificates: IndexSet<BatchCertificate<N>>, ) -> Self
Initializes a new instance of the proposal cache.
Sourcepub fn is_valid(&self, expected_signer: Address<N>) -> bool
pub fn is_valid(&self, expected_signer: Address<N>) -> bool
Ensure that the proposal and every signed proposal is associated with the expected_signer.
Sourcepub fn exists(storage_mode: &StorageMode) -> bool
pub fn exists(storage_mode: &StorageMode) -> bool
Returns true if a proposal cache exists for the given network and dev.
Sourcepub fn load(
expected_signer: Address<N>,
storage_mode: &StorageMode,
) -> Result<Self>
pub fn load( expected_signer: Address<N>, storage_mode: &StorageMode, ) -> Result<Self>
Load the proposal cache from the file system and ensure that the proposal cache is valid.
Sourcepub fn store(&self, storage_mode: &StorageMode) -> Result<()>
pub fn store(&self, storage_mode: &StorageMode) -> Result<()>
Store the proposal cache to the file system.
Sourcepub fn into(
self,
) -> (u64, Option<Proposal<N>>, SignedProposals<N>, IndexSet<BatchCertificate<N>>)
pub fn into( self, ) -> (u64, Option<Proposal<N>>, SignedProposals<N>, IndexSet<BatchCertificate<N>>)
Returns the latest round, proposal, signed proposals, and pending certificates.
Trait Implementations§
Source§impl<N: Network> Default for ProposalCache<N>
impl<N: Network> Default for ProposalCache<N>
Source§impl<N: Network> FromBytes for ProposalCache<N>
impl<N: Network> FromBytes for ProposalCache<N>
Source§impl<N: Network> ToBytes for ProposalCache<N>
impl<N: Network> ToBytes for ProposalCache<N>
impl<N: Eq + Network> Eq for ProposalCache<N>
impl<N: Network> StructuralPartialEq for ProposalCache<N>
Auto Trait Implementations§
impl<N> Freeze for ProposalCache<N>where
<N as Environment>::Field: Freeze,
<N as Environment>::Projective: Freeze,
<N as Environment>::Scalar: Freeze,
impl<N> RefUnwindSafe for ProposalCache<N>where
<N as Environment>::Field: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
<N as Network>::TransmissionChecksum: RefUnwindSafe,
<N as Network>::TransactionID: RefUnwindSafe,
N: RefUnwindSafe,
<N as Network>::BlockHash: RefUnwindSafe,
<N as Network>::StateRoot: RefUnwindSafe,
<N as Network>::TransitionID: RefUnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: RefUnwindSafe,
impl<N> Send for ProposalCache<N>
impl<N> Sync for ProposalCache<N>
impl<N> Unpin for ProposalCache<N>where
<N as Environment>::Field: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Scalar: Unpin,
<N as Network>::TransmissionChecksum: Unpin,
<N as Network>::TransactionID: Unpin,
N: Unpin,
<N as Network>::BlockHash: Unpin,
<N as Network>::StateRoot: Unpin,
<N as Network>::TransitionID: Unpin,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: Unpin,
impl<N> UnwindSafe for ProposalCache<N>where
<N as Environment>::Field: UnwindSafe,
<N as Environment>::Projective: UnwindSafe,
<N as Environment>::Scalar: UnwindSafe,
<N as Network>::TransmissionChecksum: UnwindSafe,
<N as Network>::TransactionID: UnwindSafe,
N: UnwindSafe,
<N as Network>::BlockHash: UnwindSafe,
<N as Network>::StateRoot: UnwindSafe,
<N as Network>::TransitionID: UnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: UnwindSafe + RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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