pub struct Node { /* private fields */ }
Expand description
Node controller.
Implementations§
source§impl Node
impl Node
sourcepub fn new<P: AsRef<Path>>(path: P) -> Self
pub fn new<P: AsRef<Path>>(path: P) -> Self
Connect to the node, via the socket at the given path.
sourcepub fn call<T: DeserializeOwned>(
&self,
cmd: Command,
timeout: Duration
) -> Result<impl Iterator<Item = Result<T, Error>>, Error>
pub fn call<T: DeserializeOwned>( &self, cmd: Command, timeout: Duration ) -> Result<impl Iterator<Item = Result<T, Error>>, Error>
Call a command on the node.
sourcepub fn announce(
&mut self,
rid: RepoId,
seeds: impl IntoIterator<Item = NodeId>,
timeout: Duration,
callback: impl FnMut(AnnounceEvent, &HashMap<PublicKey, Duration>) -> ControlFlow<()>
) -> Result<AnnounceResult, Error>
pub fn announce( &mut self, rid: RepoId, seeds: impl IntoIterator<Item = NodeId>, timeout: Duration, callback: impl FnMut(AnnounceEvent, &HashMap<PublicKey, Duration>) -> ControlFlow<()> ) -> Result<AnnounceResult, Error>
Announce refs of the given rid
to the given seeds.
Waits for the seeds to acknowledge the refs or times out if no acknowledgments are received
within the given time.
Trait Implementations§
source§impl Handle for Node
impl Handle for Node
source§fn listen_addrs(&self) -> Result<Vec<SocketAddr>, Error>
fn listen_addrs(&self) -> Result<Vec<SocketAddr>, Error>
Get the node’s bound listen addresses.
source§fn is_running(&self) -> bool
fn is_running(&self) -> bool
Check if the node is running.
source§fn connect(
&mut self,
nid: NodeId,
addr: Address,
opts: ConnectOptions
) -> Result<ConnectResult, Error>
fn connect( &mut self, nid: NodeId, addr: Address, opts: ConnectOptions ) -> Result<ConnectResult, Error>
Connect to a peer.
source§fn seeds(&mut self, rid: RepoId) -> Result<Seeds, Error>
fn seeds(&mut self, rid: RepoId) -> Result<Seeds, Error>
Lookup the seeds of a given repository in the routing table.
source§fn fetch(
&mut self,
rid: RepoId,
from: NodeId,
timeout: Duration
) -> Result<FetchResult, Error>
fn fetch( &mut self, rid: RepoId, from: NodeId, timeout: Duration ) -> Result<FetchResult, Error>
Fetch a repository from the network.
source§fn follow(&mut self, nid: NodeId, alias: Option<Alias>) -> Result<bool, Error>
fn follow(&mut self, nid: NodeId, alias: Option<Alias>) -> Result<bool, Error>
Start following the given peer.
source§fn seed(&mut self, rid: RepoId, scope: Scope) -> Result<bool, Error>
fn seed(&mut self, rid: RepoId, scope: Scope) -> Result<bool, Error>
Start seeding the given repo. May update the scope. Does nothing if the
repo is already seeded.
source§fn unseed(&mut self, rid: RepoId) -> Result<bool, Error>
fn unseed(&mut self, rid: RepoId) -> Result<bool, Error>
Un-seed the given repo and delete it from storage.
source§fn announce_refs(&mut self, rid: RepoId) -> Result<RefsAt, Error>
fn announce_refs(&mut self, rid: RepoId) -> Result<RefsAt, Error>
Notify the service that a project has been updated, and announce local refs.
source§fn update_inventory(&mut self, rid: RepoId) -> Result<bool, Error>
fn update_inventory(&mut self, rid: RepoId) -> Result<bool, Error>
Notify the service that our inventory was updated with the given repository.
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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