Skip to main content

NodeSupervisorHandle

Struct NodeSupervisorHandle 

Source
pub struct NodeSupervisorHandle { /* private fields */ }
Expand description

Running node supervisor.

Owns the supervised hogd-dev child and the JSON-RPC server. The handle does no proactive supervision in the background: callers are responsible for awaiting NodeSupervisorHandle::stopped (the supervisor-level “run until something ends” entry point) or driving NodeSupervisorHandle::stop directly. Both consume the handle so a single instance cannot be torn down twice.

Implementations§

Source§

impl NodeSupervisorHandle

Source

pub async fn start( config: NodeSupervisorConfig, ) -> Result<Self, NodeSupervisorError>

Spawn hogd-dev, wait for readiness, connect the scheduler x23 client, and start the JSON-RPC server.

On any failure after hogd-dev has started, the child is stopped before the error is returned, so a failed start does not leave a hogd-dev process behind.

Source

pub async fn start_with_inherited_file( config: NodeSupervisorConfig, inherited_file: Option<File>, ) -> Result<Self, NodeSupervisorError>

Start a node with one inherited file descriptor, such as a locked bundle lease. The child and its descendants retain the open file description independently of this handle and process, including after SIGKILL. The executable must preserve inherited descriptors for this guarantee.

Source

pub fn rpc_addr(&self) -> SocketAddr

Bound JSON-RPC listen address. Differs from the configured address when the caller asked for port 0.

Source

pub fn hogd_readiness(&self) -> &HogdDevReadiness

Parsed hogd-dev readiness payload.

Source

pub fn backend_planes(&self) -> BackendPlanes

Backend plane status for startup reporting.

Source

pub fn hogd_child_id(&self) -> Option<u32>

Operating-system process id for hogd-dev, if available.

Source

pub fn manual_block_producer(&self) -> Option<ManualBlockProducer>

In-process block production control when the supervisor runs in manual mode.

Source

pub async fn stopped(self) -> Result<SupervisorStop, NodeSupervisorError>

Wait until either hogd-dev exits or the JSON-RPC server stops, then tear the other side down.

If hogd-dev dies after readiness, the public JSON-RPC facade keeps answering but every backend call would fail; this method observes that and shuts the facade down so the CLI sees a clean stop instead of silent malfunction. If the JSON-RPC server stops first (e.g. via an external NodeSupervisorHandle::stop call), hogd-dev is shut down with the configured grace timeout.

Returns a SupervisorStop describing which side ended first.

Source

pub async fn run_until<F>( self, stop_signal: F, ) -> Result<SupervisorStop, NodeSupervisorError>
where F: Future<Output = Result<(), NodeSupervisorError>>,

Wait until hogd-dev exits, the JSON-RPC server stops, or an external stop signal completes, then tear the remaining side down.

This is the CLI-friendly variant of NodeSupervisorHandle::stopped: callers pass a future for Ctrl-C or another stop request without losing the ability to shut hogd-dev down cleanly.

Source

pub async fn stop(self) -> Result<ExitStatus, NodeSupervisorError>

Stop the JSON-RPC server and shut hogd-dev down with the configured grace timeout. Consumes the handle.

Trait Implementations§

Source§

impl Debug for NodeSupervisorHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> StaticIfNoAlloc for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more