struct BlockSyncClientState {
available_sync_servers: HashMap<VerifyingKey, BlockHeight>,
blacklist: VecDeque<(VerifyingKey, Instant)>,
last_progress_or_sync_time: Instant,
highest_pc_view: ViewNumber,
}
Fields§
§available_sync_servers: HashMap<VerifyingKey, BlockHeight>
Replicas that are currently available to be sync servers,
blacklist: VecDeque<(VerifyingKey, Instant)>
A list of replicas (identified by their public addresses) that will be ignored by the block sync client until the paired instant. “Ignored” here means that:
- These replicas will not be selected as sync servers.
- Advertise messages received from these replicas will be ignored.
last_progress_or_sync_time: Instant
The most recent instant in time when either:
- Progress was made (the highest PC was updated).
- The block sync procedure was completed (not necessarily successfully).
highest_pc_view: ViewNumber
Cached value of block_tree.highest_pc().view
.
Implementations§
source§impl BlockSyncClientState
impl BlockSyncClientState
sourcefn initialize() -> Self
fn initialize() -> Self
Initialize the internal state of the block sync client.
sourcefn blacklist_contains_server_address(&self, sync_server: &VerifyingKey) -> bool
fn blacklist_contains_server_address(&self, sync_server: &VerifyingKey) -> bool
Check if a given server address is in the blacklist.
fn register_or_update_sync_server( &mut self, sync_server: VerifyingKey, highest_committed_block_height: BlockHeight, )
sourcefn blacklist_sync_server(
&mut self,
sync_server: VerifyingKey,
blacklist_expiry_time: Duration,
)
fn blacklist_sync_server( &mut self, sync_server: VerifyingKey, blacklist_expiry_time: Duration, )
Blacklist a given sync server by:
- Removing it from available sync servers,
- Adding it to the blacklist.
sourcefn remove_expired_blacklisted_servers(&mut self)
fn remove_expired_blacklisted_servers(&mut self)
Remove all sync servers whose blacklisting has expired from the blacklist.
sourcefn random_sync_server(
&self,
min_highest_committed_block_height: &Option<BlockHeight>,
) -> Option<VerifyingKey>
fn random_sync_server( &self, min_highest_committed_block_height: &Option<BlockHeight>, ) -> Option<VerifyingKey>
Select a random sync server from available sync servers, with the condition that the sync server
must have advertised a block higher than highest_committed_block_height
.
Auto Trait Implementations§
impl Freeze for BlockSyncClientState
impl RefUnwindSafe for BlockSyncClientState
impl Send for BlockSyncClientState
impl Sync for BlockSyncClientState
impl Unpin for BlockSyncClientState
impl UnwindSafe for BlockSyncClientState
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