pub trait Handle:
Clone
+ Sync
+ Send {
type Sessions;
type Events: IntoIterator<Item = Self::Event>;
type Event;
type Error: Error + Send + Sync + 'static;
Show 23 methods
// Required methods
fn nid(&self) -> Result<PublicKey, Self::Error>;
fn is_running(&self) -> bool;
fn listen_addrs(&self) -> Result<Vec<SocketAddr>, Self::Error>;
fn config(&self) -> Result<Config, Self::Error>;
fn connect(
&mut self,
node: PublicKey,
addr: Address,
opts: ConnectOptions,
) -> Result<ConnectResult, Self::Error>;
fn disconnect(&mut self, node: PublicKey) -> Result<(), Self::Error>;
fn seeds_for(
&mut self,
id: RepoId,
namespaces: impl IntoIterator<Item = PublicKey>,
) -> Result<Seeds, Self::Error>;
fn fetch(
&mut self,
id: RepoId,
from: PublicKey,
timeout: Duration,
) -> Result<FetchResult, Self::Error>;
fn seed(&mut self, id: RepoId, scope: Scope) -> Result<bool, Self::Error>;
fn follow(
&mut self,
id: PublicKey,
alias: Option<Alias>,
) -> Result<bool, Self::Error>;
fn block(&mut self, id: PublicKey) -> Result<bool, Self::Error>;
fn unseed(&mut self, id: RepoId) -> Result<bool, Self::Error>;
fn unfollow(&mut self, id: PublicKey) -> Result<bool, Self::Error>;
fn announce_refs_for(
&mut self,
id: RepoId,
namespaces: impl IntoIterator<Item = PublicKey>,
) -> Result<RefsAt, Self::Error>;
fn announce_inventory(&mut self) -> Result<(), Self::Error>;
fn add_inventory(&mut self, rid: RepoId) -> Result<bool, Self::Error>;
fn shutdown(self) -> Result<(), Self::Error>;
fn sessions(&self) -> Result<Self::Sessions, Self::Error>;
fn session(&self, node: PublicKey) -> Result<Option<Session>, Self::Error>;
fn subscribe(&self, timeout: Duration) -> Result<Self::Events, Self::Error>;
fn debug(&self) -> Result<Value, Self::Error>;
// Provided methods
fn seeds(&mut self, id: RepoId) -> Result<Seeds, Self::Error> { ... }
fn announce_refs(&mut self, id: RepoId) -> Result<RefsAt, Self::Error> { ... }
}Expand description
A handle to send commands to the node or request information.
Required Associated Types§
Required Methods§
Sourcefn is_running(&self) -> bool
fn is_running(&self) -> bool
Check if the node is running.
Sourcefn listen_addrs(&self) -> Result<Vec<SocketAddr>, Self::Error>
fn listen_addrs(&self) -> Result<Vec<SocketAddr>, Self::Error>
Get the node’s bound listen addresses.
Sourcefn connect(
&mut self,
node: PublicKey,
addr: Address,
opts: ConnectOptions,
) -> Result<ConnectResult, Self::Error>
fn connect( &mut self, node: PublicKey, addr: Address, opts: ConnectOptions, ) -> Result<ConnectResult, Self::Error>
Connect to a peer.
Sourcefn seeds_for(
&mut self,
id: RepoId,
namespaces: impl IntoIterator<Item = PublicKey>,
) -> Result<Seeds, Self::Error>
fn seeds_for( &mut self, id: RepoId, namespaces: impl IntoIterator<Item = PublicKey>, ) -> Result<Seeds, Self::Error>
Look up the seeds of a given repository in the routing table
and report sync status for namespaces.
Sourcefn fetch(
&mut self,
id: RepoId,
from: PublicKey,
timeout: Duration,
) -> Result<FetchResult, Self::Error>
fn fetch( &mut self, id: RepoId, from: PublicKey, timeout: Duration, ) -> Result<FetchResult, Self::Error>
Fetch a repository from the network.
Sourcefn seed(&mut self, id: RepoId, scope: Scope) -> Result<bool, Self::Error>
fn seed(&mut self, id: RepoId, scope: Scope) -> Result<bool, Self::Error>
Start seeding the given repo. May update the scope. Does nothing if the repo is already seeded.
Sourcefn follow(
&mut self,
id: PublicKey,
alias: Option<Alias>,
) -> Result<bool, Self::Error>
fn follow( &mut self, id: PublicKey, alias: Option<Alias>, ) -> Result<bool, Self::Error>
Start following the given peer.
Sourcefn block(&mut self, id: PublicKey) -> Result<bool, Self::Error>
fn block(&mut self, id: PublicKey) -> Result<bool, Self::Error>
Set the following policy to block for the given peer.
Sourcefn unseed(&mut self, id: RepoId) -> Result<bool, Self::Error>
fn unseed(&mut self, id: RepoId) -> Result<bool, Self::Error>
Un-seed the given repo and delete it from storage.
Sourcefn announce_refs_for(
&mut self,
id: RepoId,
namespaces: impl IntoIterator<Item = PublicKey>,
) -> Result<RefsAt, Self::Error>
fn announce_refs_for( &mut self, id: RepoId, namespaces: impl IntoIterator<Item = PublicKey>, ) -> Result<RefsAt, Self::Error>
Notify the service that a repository has been updated, and references
for the given namespaces should be announced over the network.
Sourcefn announce_inventory(&mut self) -> Result<(), Self::Error>
fn announce_inventory(&mut self) -> Result<(), Self::Error>
Announce local inventory.
Sourcefn add_inventory(&mut self, rid: RepoId) -> Result<bool, Self::Error>
fn add_inventory(&mut self, rid: RepoId) -> Result<bool, Self::Error>
Notify the service that our inventory was updated with the given repository.
Sourcefn session(&self, node: PublicKey) -> Result<Option<Session>, Self::Error>
fn session(&self, node: PublicKey) -> Result<Option<Session>, Self::Error>
Query the state of a peer session. Returns None if no session was found.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.