pub struct NodeCore {Show 24 fields
runtime: Runtime,
config: NodeConfig,
sentinel: SentinelClient,
worker_pool: WorkerPool,
state: NodeState,
connection_status: ConnectionStatus,
registered: bool,
node_name: String,
total_cores: u32,
app_name: String,
app_version: String,
work_context_cache: WorkContextCache,
verify_rx: Option<Receiver<Result<Sensitive<String>, VerifyError>>>,
register_rx: Option<Receiver<RegisterResult>>,
realtime_rx: Option<Receiver<RealtimeEvent>>,
realtime_shutdown: Option<CancellationToken>,
result_rx: Option<Receiver<WorkBatchResult>>,
unlink_rx: Option<Receiver<Result<UnlinkOutcome, UnlinkError>>>,
unlink_cancel: Option<CancellationToken>,
unlink_origin: Option<UnlinkOrigin>,
backoff: ExponentialBackoff,
event_tx: Sender<NodeCoreEvent>,
unlink_event_tx: UnboundedSender<NodeCoreEvent>,
started: bool,
}Expand description
Event-driven node controller.
Fields§
§runtime: Runtime§config: NodeConfig§sentinel: SentinelClient§worker_pool: WorkerPool§state: NodeState§connection_status: ConnectionStatus§registered: bool§node_name: String§total_cores: u32§app_name: String§app_version: String§work_context_cache: WorkContextCache§verify_rx: Option<Receiver<Result<Sensitive<String>, VerifyError>>>§register_rx: Option<Receiver<RegisterResult>>§realtime_rx: Option<Receiver<RealtimeEvent>>§realtime_shutdown: Option<CancellationToken>§result_rx: Option<Receiver<WorkBatchResult>>§unlink_rx: Option<Receiver<Result<UnlinkOutcome, UnlinkError>>>§unlink_cancel: Option<CancellationToken>§unlink_origin: Option<UnlinkOrigin>§backoff: ExponentialBackoff§event_tx: Sender<NodeCoreEvent>§unlink_event_tx: UnboundedSender<NodeCoreEvent>§started: boolImplementations§
Source§impl NodeCore
impl NodeCore
pub(super) fn start_verification(&mut self)
pub(super) fn check_verification(&mut self)
pub(super) fn check_retry(&mut self)
pub(super) fn start_registration(&mut self)
pub(super) fn start_realtime(&mut self)
pub(super) fn check_registration(&mut self)
Source§impl NodeCore
impl NodeCore
Sourcepub fn set_token_claim(&mut self, token: String)
pub fn set_token_claim(&mut self, token: String)
Set claim token and start registration.
Sourcepub fn drive_until_stopped(
&mut self,
events: &mut NodeEvents,
running: &AtomicBool,
on_event: impl FnMut(&NodeCoreEvent, &Self),
)
pub fn drive_until_stopped( &mut self, events: &mut NodeEvents, running: &AtomicBool, on_event: impl FnMut(&NodeCoreEvent, &Self), )
Drive the node and its events on the current thread until running becomes false.
pub fn state(&self) -> &NodeState
pub fn connection_status(&self) -> ConnectionStatus
pub fn public_key(&self) -> &NodePublicKey
pub fn is_registered(&self) -> bool
pub fn node_name(&self) -> &str
pub fn stats(&self) -> NodeStats
pub fn time_until_retry(&self) -> Option<Duration>
pub fn disconnect(&mut self)
pub fn reconnect(&mut self)
pub fn runtime_handle(&self) -> &Handle
pub(super) fn set_state(&mut self, state: NodeState)
pub(super) fn set_connection(&mut self, status: ConnectionStatus)
Source§impl NodeCore
impl NodeCore
Sourcepub fn request_unlink(&mut self)
pub fn request_unlink(&mut self)
Start an observable unlink operation; repeated calls while active are idempotent.
Sourcepub fn cancel_unlink(&self)
pub fn cancel_unlink(&self)
Cancel an active unlink without deleting the persisted identity.
Sourcepub fn is_unlinking(&self) -> bool
pub fn is_unlinking(&self) -> bool
Whether an unlink request is awaiting terminal completion.
pub(super) fn check_unlink(&mut self)
fn set_unlink_state(&mut self, state: NodeState)
fn set_unlink_connection(&mut self, status: ConnectionStatus)
fn disconnect_for_unlink(&mut self)
Source§impl NodeCore
impl NodeCore
pub(super) fn check_realtime_events(&mut self)
pub(super) fn check_work_results(&mut self)
fn handle_realtime_event(&mut self, event: &RealtimeEvent)
fn handle_node_update( &mut self, name: &str, total_cores: i32, max_parallel: i32, )
fn handle_chunk_assigned(&mut self, payload: &RuntimeChunkPayload)
fn process_chunk(&mut self, job_id: Uuid, payload: &RuntimeChunkPayload)
fn handle_work_result(&self, result: &WorkBatchResult)
Source§impl NodeCore
impl NodeCore
Sourcepub fn with_resolver<R>(
config: NodeConfig,
resolver: R,
application: NodeApplication,
catalog: &'static ContentCatalog,
) -> Result<(Self, NodeEvents), SentinelError>
pub fn with_resolver<R>( config: NodeConfig, resolver: R, application: NodeApplication, catalog: &'static ContentCatalog, ) -> Result<(Self, NodeEvents), SentinelError>
Construct a node using a caller-supplied data resolver.
§Errors
Returns an error when the Tokio runtime or signed Sentinel client cannot be initialized.
Sourcepub fn with_supabase(
config: NodeConfig,
application: NodeApplication,
catalog: &'static ContentCatalog,
) -> Result<(Self, NodeEvents), SentinelError>
pub fn with_supabase( config: NodeConfig, application: NodeApplication, catalog: &'static ContentCatalog, ) -> Result<(Self, NodeEvents), SentinelError>
Construct a node wired to the Supabase data resolver.
§Errors
Returns an error when the Tokio runtime, Supabase client, metadata lookup, or data resolver cannot be initialized.
fn new( runtime: Runtime, resolver: Arc<DynDataResolver<'static>>, config: NodeConfig, application: NodeApplication, catalog: &'static ContentCatalog, ) -> Result<(Self, NodeEvents), SentinelError>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for NodeCore
impl !RefUnwindSafe for NodeCore
impl Send for NodeCore
impl Sync for NodeCore
impl Unpin for NodeCore
impl UnsafeUnpin for NodeCore
impl !UnwindSafe for NodeCore
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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