Struct bitcoin_peerman::TxRequestTrackerImpl
source · pub struct TxRequestTrackerImpl {
pub current_sequence: SequenceNumber,
pub computer: PriorityComputer,
pub index: Arc<AnnouncementIndex>,
pub peerinfo: HashMap<NodeId, PeerInfo>,
}Expand description
| Actual implementation for TxRequestTracker’s | data structure. |
Fields§
§current_sequence: SequenceNumber| The current sequence number. Increases | for every announcement. This is used | to sort txhashes returned by GetRequestable | in announcement order. |
computer: PriorityComputer| This tracker’s priority computer. |
index: Arc<AnnouncementIndex>| This tracker’s main data structure. | See SanityCheck() for the invariants | that apply to it. |
peerinfo: HashMap<NodeId, PeerInfo>| Map with this tracker’s per-peer statistics. |
Implementations§
source§impl TxRequestTrackerImpl
impl TxRequestTrackerImpl
pub fn sanity_check(&self)
pub fn post_get_requestable_sanity_check(&self, now: OffsetDateTime)
sourcepub fn erase_with_peekable<I: AnnouncementIterator>(
&mut self,
it: &mut CppIter<I>
) -> CppIter<I>
pub fn erase_with_peekable<I: AnnouncementIterator>( &mut self, it: &mut CppIter<I> ) -> CppIter<I>
| Wrapper around Index::…::erase | that keeps m_peerinfo up to date. |
sourcepub fn erase<I: AnnouncementIterator>(&mut self, it: &I) -> I
pub fn erase<I: AnnouncementIterator>(&mut self, it: &I) -> I
| Wrapper around Index::…::erase | that keeps m_peerinfo up to date. |
sourcepub fn modify_with_peekable<I: AnnouncementIterator>(
&mut self,
it: &mut CppIter<I>,
modifier: AnnouncementModifier
)
pub fn modify_with_peekable<I: AnnouncementIterator>( &mut self, it: &mut CppIter<I>, modifier: AnnouncementModifier )
| Wrapper around Index::…::modify | that keeps m_peerinfo up to date. |
sourcepub fn modify<I: AnnouncementIterator>(
&mut self,
it: &I,
modifier: AnnouncementModifier
)
pub fn modify<I: AnnouncementIterator>( &mut self, it: &I, modifier: AnnouncementModifier )
| Wrapper around Index::…::modify | that keeps m_peerinfo up to date. |
sourcepub fn promote_candidate_ready(&mut self, it: Option<ByTxHashIterator>)
pub fn promote_candidate_ready(&mut self, it: Option<ByTxHashIterator>)
| Convert a CANDIDATE_DELAYED | announcement into | a CANDIDATE_READY. If this makes it | the new best CANDIDATE_READY (and no | REQUESTED exists) and better than the | CANDIDATE_BEST (if any), it becomes | the new CANDIDATE_BEST.
sourcepub fn change_and_reselect(
&mut self,
it: Option<ByTxHashIterator>,
new_state: State
)
pub fn change_and_reselect( &mut self, it: Option<ByTxHashIterator>, new_state: State )
| Change the state of an announcement to | something non-IsSelected(). If it was | IsSelected(), the next best | announcement will be marked | CANDIDATE_BEST.
sourcepub fn is_only_non_completed(&mut self, it: Option<ByTxHashIterator>) -> bool
pub fn is_only_non_completed(&mut self, it: Option<ByTxHashIterator>) -> bool
| Check if ‘it’ is the only announcement | for a given txhash that isn’t COMPLETED. |
sourcepub fn make_completed(&mut self, it: &mut Option<ByTxHashIterator>) -> bool
pub fn make_completed(&mut self, it: &mut Option<ByTxHashIterator>) -> bool
| Convert any announcement to a COMPLETED | one. If there are no non-COMPLETED announcements | left for this txhash, they are deleted. | If this was a REQUESTED announcement, | and there are other CANDIDATEs left, | the best one is made | CANDIDATE_BEST. Returns whether the | announcement still exists. |
sourcepub fn set_time_point(
&mut self,
now: OffsetDateTime,
expired: Amo<Vec<(NodeId, GenTxId)>>
)
pub fn set_time_point( &mut self, now: OffsetDateTime, expired: Amo<Vec<(NodeId, GenTxId)>> )
| Make the data structure consistent | with a given point in time: | | - REQUESTED announcements with expiry | <= now are turned into COMPLETED. | | - CANDIDATE_DELAYED announcements with | reqtime <= now are turned into | CANDIDATE_{READY,BEST}. | | - CANDIDATE_{READY,BEST} announcements | with reqtime > now are turned into | CANDIDATE_DELAYED.
pub fn new(deterministic: bool) -> Self
pub fn disconnected_peer(&mut self, peer: NodeId)
pub fn forget_tx_hash(&mut self, txhash: &u256)
pub fn received_inv( &mut self, peer: NodeId, gtxid: &GenTxId, preferred: bool, reqtime: OffsetDateTime )
sourcepub fn get_requestable(
&mut self,
peer: NodeId,
now: OffsetDateTime,
expired: Amo<Vec<(NodeId, GenTxId)>>
) -> Vec<GenTxId>
pub fn get_requestable( &mut self, peer: NodeId, now: OffsetDateTime, expired: Amo<Vec<(NodeId, GenTxId)>> ) -> Vec<GenTxId>
| Find the GenTxIds to request now from | peer. |
pub fn requested_tx( &mut self, peer: NodeId, txhash: &u256, expiry: OffsetDateTime )
pub fn received_response(&mut self, peer: NodeId, txhash: &u256)
pub fn count_in_flight(&self, peer: NodeId) -> usize
pub fn count_candidates(&self, peer: NodeId) -> usize
pub fn count(&self, peer: NodeId) -> usize
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
| Count how many announcements are being | tracked in total across all peers and | transactions. |