pub struct Discovery { /* private fields */ }Implementations§
Source§impl Discovery
impl Discovery
pub const DIALS_PER_ROUND: usize = 2
pub const OPERATIONS_PER_ROUND: usize = 3
Sourcepub const GOSSIP_EVERY: u64 = 30
pub const GOSSIP_EVERY: u64 = 30
Rounds between address requests to one random connected peer.
pub const GOSSIP_LIMIT: u32 = 32
Sourcepub const SEED_EVERY: u64 = 600
pub const SEED_EVERY: u64 = 600
Rounds between seed passes while below target but connected.
Sourcepub const BOOTSTRAP_REACHED: u64 = 4
pub const BOOTSTRAP_REACHED: u64 = 4
At startup seeds are dialed while fewer entries than this were ever reached.
Sourcepub const OPERATION_TIME: Duration
pub const OPERATION_TIME: Duration
Wall-clock bound of one dial or address request.
Sourcepub fn new(
network: Arc<PeerNetwork>,
book: Arc<Mutex<PeerBook>>,
path: PathBuf,
) -> Self
pub fn new( network: Arc<PeerNetwork>, book: Arc<Mutex<PeerBook>>, path: PathBuf, ) -> Self
path is where the book is saved after a round changes it.
Sourcepub fn hold_off(&self, peers: Vec<String>) -> Result<(), Error>
pub fn hold_off(&self, peers: Vec<String>) -> Result<(), Error>
Peers inventory sync is holding off (evicted, idle or blamed): neither seed passes nor candidate dials reconnect them until they leave this set.
Sourcepub fn step(&self, engine: &Engine, stop: &AtomicBool) -> Result<(), Error>
pub fn step(&self, engine: &Engine, stop: &AtomicBool) -> Result<(), Error>
One bounded round: merge peers learned through identify, refresh the served gossip snapshot, seeds when due, up to two dials while below target, every thirtieth round one address request.
pub fn status(&self) -> Result<DiscoveryStatus, Error>
Sourcepub fn penalize(&self, peers: &[PeerId]) -> Result<(), Error>
pub fn penalize(&self, peers: &[PeerId]) -> Result<(), Error>
Peers the inventory scheduler caught misbehaving back off in the book too, so discovery stops dialing them; the book is saved if it changed.
pub fn book(&self) -> Result<Vec<BookEntry>, Error>
Auto Trait Implementations§
impl !Freeze for Discovery
impl !RefUnwindSafe for Discovery
impl !UnwindSafe for Discovery
impl Send for Discovery
impl Sync for Discovery
impl Unpin for Discovery
impl UnsafeUnpin for Discovery
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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