pub trait Handle:
Clone
+ Sync
+ Send {
type Sessions;
type Events: IntoIterator<Item = Self::Event>;
type Event;
type Error: Error + Send + Sync + 'static;
Show 20 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(&mut self, id: RepoId) -> 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 unseed(&mut self, id: RepoId) -> Result<bool, Self::Error>;
fn unfollow(&mut self, id: PublicKey) -> Result<bool, Self::Error>;
fn announce_refs(&mut self, id: RepoId) -> 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>;
}
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(&mut self, id: RepoId) -> Result<Seeds, Self::Error>
fn seeds(&mut self, id: RepoId) -> Result<Seeds, Self::Error>
Lookup the seeds of a given repository in the routing table.
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 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(&mut self, id: RepoId) -> Result<RefsAt, Self::Error>
fn announce_refs(&mut self, id: RepoId) -> Result<RefsAt, Self::Error>
Notify the service that a project has been updated, and announce local refs.
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.
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.