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

source

pub fn sanity_check(&self)

source

pub fn post_get_requestable_sanity_check(&self, now: OffsetDateTime)

source

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. |

source

pub fn erase<I: AnnouncementIterator>(&mut self, it: &I) -> I

| Wrapper around Index::…::erase | that keeps m_peerinfo up to date. |

source

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. |

source

pub fn modify<I: AnnouncementIterator>( &mut self, it: &I, modifier: AnnouncementModifier )

| Wrapper around Index::…::modify | that keeps m_peerinfo up to date. |

source

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.

source

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.

source

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. |

source

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. |

source

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.

source

pub fn new(deterministic: bool) -> Self

source

pub fn disconnected_peer(&mut self, peer: NodeId)

source

pub fn forget_tx_hash(&mut self, txhash: &u256)

source

pub fn received_inv( &mut self, peer: NodeId, gtxid: &GenTxId, preferred: bool, reqtime: OffsetDateTime )

source

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. |

source

pub fn requested_tx( &mut self, peer: NodeId, txhash: &u256, expiry: OffsetDateTime )

source

pub fn received_response(&mut self, peer: NodeId, txhash: &u256)

source

pub fn count_in_flight(&self, peer: NodeId) -> usize

source

pub fn count_candidates(&self, peer: NodeId) -> usize

source

pub fn count(&self, peer: NodeId) -> usize

source

pub fn size(&self) -> usize

| Count how many announcements are being | tracked in total across all peers and | transactions. |

source

pub fn compute_priority( &self, txhash: &u256, peer: NodeId, preferred: bool ) -> u64

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, U> CastInto<U> for Twhere U: CastFrom<T>,

§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> StaticUpcast<T> for T

§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V