pub struct NetworkManager { /* private fields */ }Expand description
Network manager for FAI Protocol
Implementations§
Source§impl NetworkManager
impl NetworkManager
Sourcepub fn new(
storage: Arc<StorageManager>,
database: DatabaseManager,
) -> Result<Self>
pub fn new( storage: Arc<StorageManager>, database: DatabaseManager, ) -> Result<Self>
Sourcepub async fn poll_events(&mut self) -> Result<()>
pub async fn poll_events(&mut self) -> Result<()>
Sourcepub fn list_peers(&self) -> Vec<PeerInfo>
pub fn list_peers(&self) -> Vec<PeerInfo>
Sourcepub fn local_peer_id(&self) -> PeerId
pub fn local_peer_id(&self) -> PeerId
Sourcepub fn connect_to_peer(&mut self, addr: Multiaddr) -> Result<()>
pub fn connect_to_peer(&mut self, addr: Multiaddr) -> Result<()>
Sourcepub fn load_peers_from_files(&mut self) -> Result<usize>
pub fn load_peers_from_files(&mut self) -> Result<usize>
Load peer info from shared files (useful for testing)
Sourcepub fn connect_to_known_peers(
&mut self,
peer_addrs: Vec<(PeerId, Multiaddr)>,
) -> Result<()>
pub fn connect_to_known_peers( &mut self, peer_addrs: Vec<(PeerId, Multiaddr)>, ) -> Result<()>
Sourcepub async fn request_commits(
&mut self,
peer: PeerId,
commit_hash: Option<String>,
) -> Result<Vec<CommitInfo>>
pub async fn request_commits( &mut self, peer: PeerId, commit_hash: Option<String>, ) -> Result<Vec<CommitInfo>>
Sourcepub async fn send_commits(
&mut self,
peer: PeerId,
commits: Vec<CommitInfo>,
) -> Result<()>
pub async fn send_commits( &mut self, peer: PeerId, commits: Vec<CommitInfo>, ) -> Result<()>
Auto Trait Implementations§
impl !Freeze for NetworkManager
impl !RefUnwindSafe for NetworkManager
impl !Sync for NetworkManager
impl !UnwindSafe for NetworkManager
impl Send for NetworkManager
impl Unpin for NetworkManager
impl UnsafeUnpin for NetworkManager
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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