pub struct Node { /* private fields */ }Expand description
Node controller.
Implementations§
Source§impl Node
impl Node
Sourcepub fn call<T>(
&self,
cmd: Command,
timeout: Duration,
) -> Result<LineIter<T>, Error>where
T: DeserializeOwned + Send + 'static,
pub fn call<T>(
&self,
cmd: Command,
timeout: Duration,
) -> Result<LineIter<T>, Error>where
T: DeserializeOwned + Send + 'static,
Call a command on the node.
Sourcepub fn announce(
&mut self,
rid: RepoId,
namespaces: impl IntoIterator<Item = PublicKey>,
timeout: Duration,
announcer: Announcer,
report: impl FnMut(&PublicKey, Progress),
) -> Result<AnnouncerResult, Error>
pub fn announce( &mut self, rid: RepoId, namespaces: impl IntoIterator<Item = PublicKey>, timeout: Duration, announcer: Announcer, report: impl FnMut(&PublicKey, Progress), ) -> Result<AnnouncerResult, 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
type Events = LineIter<Event>
type Event = Result<Event, Error>
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: PublicKey,
addr: Address,
opts: ConnectOptions,
) -> Result<ConnectResult, Error>
fn connect( &mut self, nid: PublicKey, addr: Address, opts: ConnectOptions, ) -> Result<ConnectResult, Error>
Connect to a peer.
Source§fn disconnect(&mut self, nid: PublicKey) -> Result<(), <Node as Handle>::Error>
fn disconnect(&mut self, nid: PublicKey) -> Result<(), <Node as Handle>::Error>
Disconnect from a peer.
Source§fn seeds_for(
&mut self,
rid: RepoId,
namespaces: impl IntoIterator<Item = PublicKey>,
) -> Result<Seeds, Error>
fn seeds_for( &mut self, rid: RepoId, namespaces: impl IntoIterator<Item = PublicKey>, ) -> Result<Seeds, Error>
Look up the seeds of a given repository in the routing table
and report sync status for
namespaces.Source§fn fetch(
&mut self,
rid: RepoId,
from: PublicKey,
timeout: Duration,
) -> Result<FetchResult, Error>
fn fetch( &mut self, rid: RepoId, from: PublicKey, timeout: Duration, ) -> Result<FetchResult, Error>
Fetch a repository from the network.
Source§fn follow(
&mut self,
nid: PublicKey,
alias: Option<Alias>,
) -> Result<bool, Error>
fn follow( &mut self, nid: PublicKey, alias: Option<Alias>, ) -> Result<bool, Error>
Start following the given peer.
Source§fn block(&mut self, nid: PublicKey) -> Result<bool, Error>
fn block(&mut self, nid: PublicKey) -> Result<bool, Error>
Set the following policy to block for 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_for(
&mut self,
rid: RepoId,
namespaces: impl IntoIterator<Item = PublicKey>,
) -> Result<RefsAt, Error>
fn announce_refs_for( &mut self, rid: RepoId, namespaces: impl IntoIterator<Item = PublicKey>, ) -> Result<RefsAt, Error>
Notify the service that a repository has been updated, and references
for the given
namespaces should be announced over the network.Source§fn add_inventory(&mut self, rid: RepoId) -> Result<bool, Error>
fn add_inventory(&mut self, rid: RepoId) -> Result<bool, Error>
Notify the service that our inventory was updated with the given repository.
Source§fn subscribe(&self, timeout: Duration) -> Result<LineIter<Event>, Error>
fn subscribe(&self, timeout: Duration) -> Result<LineIter<Event>, Error>
Subscribe to node events.
Source§fn session(&self, nid: PublicKey) -> Result<Option<Session>, Error>
fn session(&self, nid: PublicKey) -> Result<Option<Session>, Error>
Query the state of a peer session. Returns
None if no session was found.Source§fn debug(&self) -> Result<Value, <Node as Handle>::Error>
fn debug(&self) -> Result<Value, <Node as Handle>::Error>
Return debug information as a JSON value.
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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