pub struct Service { /* private fields */ }Expand description
A handle to the debug service.
Exposes methods to interact with the debug service. Currently, the debug service only provides a stream of mesh topology events, which are emitted whenever the mesh topology changes.
§Example
use futures::StreamExt as _;
use hyveos_sdk::Connection;
let connection = Connection::new().await.unwrap();
let mut debug_service = connection.debug();
let mut events = debug_service.subscribe_mesh_topology().await.unwrap();
while let Some(event) = events.next().await {
println!("{event:?}");
}Implementations§
Source§impl Service
impl Service
Sourcepub async fn subscribe_mesh_topology(
&mut self,
) -> Result<impl Stream<Item = Result<MeshTopologyEvent>>>
pub async fn subscribe_mesh_topology( &mut self, ) -> Result<impl Stream<Item = Result<MeshTopologyEvent>>>
Subscribes to mesh topology events.
Returns a stream of mesh topology events. The stream will emit an event whenever the mesh topology changes.
For each peer in the mesh, it is guaranteed that the stream will first emit an event with a
NeighbourEvent::Init when it enters the mesh, followed by only events with
NeighbourEvent::Discovered or NeighbourEvent::Lost, until the peer leaves the mesh.
§Errors
Returns an error if the RPC call fails. The stream emits errors that occur in the runtime while processing the events, as well as data conversion errors.
§Example
use futures::TryStreamExt as _;
use hyveos_sdk::Connection;
let connection = Connection::new().await.unwrap();
let mut debug_service = connection.debug();
let mut events = debug_service.subscribe_mesh_topology().await.unwrap();
while let Some(event) = events.try_next().await.unwrap() {
println!("{event:?}");
}Sourcepub async fn subscribe_messages(
&mut self,
) -> Result<impl Stream<Item = Result<MessageDebugEvent>>>
pub async fn subscribe_messages( &mut self, ) -> Result<impl Stream<Item = Result<MessageDebugEvent>>>
Subscribes to message debug events.
Returns a stream of mesh debug events. The stream will emit an event whenever a request, response, or gossipsub message is sent by a peer in the mesh.
§Errors
Returns an error if the RPC call fails. The stream emits errors that occur in the runtime while processing the events, as well as data conversion errors.
§Example
use futures::TryStreamExt as _;
use hyveos_sdk::Connection;
let connection = Connection::new().await.unwrap();
let mut debug_service = connection.debug();
let mut events = debug_service.subscribe_messages().await.unwrap();
while let Some(event) = events.try_next().await.unwrap() {
println!("{event:?}");
}Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Service
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl !UnwindSafe for Service
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request