pub struct ClusterRuntimeHandle { /* private fields */ }Expand description
Shared handle to a live NodeRuntime stored on AppState.
The runtime lives behind a mutex so admin handlers can call async
mut methods (split_tablet / merge_tablets). shutdown takes the
runtime out once so graceful stop is single-shot even when the handle
is cloned across the router and ServerControl.
Implementations§
Source§impl ClusterRuntimeHandle
impl ClusterRuntimeHandle
Sourcepub async fn start(
options: ClusterRuntimeOptions,
) -> Result<Self, ClusterRuntimeError>
pub async fn start( options: ClusterRuntimeOptions, ) -> Result<Self, ClusterRuntimeError>
Load identity + bootstrap state from options.node_data, start the
runtime, and wrap it. Fails closed when the node has not been
provisioned (cluster init / cluster join).
Sourcepub async fn runtime_status_json(&self) -> Result<Value, ClusterRuntimeError>
pub async fn runtime_status_json(&self) -> Result<Value, ClusterRuntimeError>
JSON view of RuntimeStatus for admin status surfaces.
Sourcepub async fn transfer_leader(
&self,
tablet_id: TabletId,
to: NodeId,
) -> Result<Value, ClusterRuntimeError>
pub async fn transfer_leader( &self, tablet_id: TabletId, to: NodeId, ) -> Result<Value, ClusterRuntimeError>
TRANSFER LEADER <tablet> TO <node> against a live tablet group.
Sourcepub async fn split_tablet(
&self,
tablet_id: TabletId,
at_key_hex: Option<String>,
) -> Result<Value, ClusterRuntimeError>
pub async fn split_tablet( &self, tablet_id: TabletId, at_key_hex: Option<String>, ) -> Result<Value, ClusterRuntimeError>
SPLIT TABLET against a live runtime (requires meta + hosted tablet).
Sourcepub async fn merge_tablets(
&self,
left: TabletId,
right: TabletId,
) -> Result<Value, ClusterRuntimeError>
pub async fn merge_tablets( &self, left: TabletId, right: TabletId, ) -> Result<Value, ClusterRuntimeError>
MERGE TABLETS against a live runtime (requires meta + hosted pair).
Sourcepub fn runtime_mutex(&self) -> Arc<Mutex<Option<NodeRuntime>>> ⓘ
pub fn runtime_mutex(&self) -> Arc<Mutex<Option<NodeRuntime>>> ⓘ
Direct access for tests that need to seed tablets onto the live runtime.
Sourcepub async fn attach_internal_rpc_handler(
&self,
service_id: u32,
handler: Arc<dyn InternalRpcHandler>,
) -> Result<(), ClusterRuntimeError>
pub async fn attach_internal_rpc_handler( &self, service_id: u32, handler: Arc<dyn InternalRpcHandler>, ) -> Result<(), ClusterRuntimeError>
Installs one authenticated node-internal RPC service.
Sourcepub async fn internal_rpc_client(
&self,
) -> Result<NodeInternalRpcClient, ClusterRuntimeError>
pub async fn internal_rpc_client( &self, ) -> Result<NodeInternalRpcClient, ClusterRuntimeError>
Gets a cloneable client for authenticated internal fan-out.
Sourcepub fn tablet_database_try(&self, tablet_id: TabletId) -> Option<Arc<Database>>
pub fn tablet_database_try(&self, tablet_id: TabletId) -> Option<Arc<Database>>
Resolve the applied engine core for one locally hosted tablet.
Uses try_lock so fragment/AI workers never block the async runtime
mutex; contention fails closed with None (caller retries / errors).
Sourcepub async fn tablet_ids(&self) -> Result<Vec<TabletId>, ClusterRuntimeError>
pub async fn tablet_ids(&self) -> Result<Vec<TabletId>, ClusterRuntimeError>
Hosted tablet ids on this node (tablet-id order), for public data routing.
Sourcepub async fn tablet_rows(
&self,
tablet_id: TabletId,
) -> Result<BTreeMap<Key, Vec<u8>>, ClusterRuntimeError>
pub async fn tablet_rows( &self, tablet_id: TabletId, ) -> Result<BTreeMap<Key, Vec<u8>>, ClusterRuntimeError>
Current applied opaque tablet rows (local replica view) for a hosted tablet.
Sourcepub async fn tablet_typed_rows(
&self,
tablet_id: TabletId,
) -> Result<TypedTabletRows, ClusterRuntimeError>
pub async fn tablet_typed_rows( &self, tablet_id: TabletId, ) -> Result<TypedTabletRows, ClusterRuntimeError>
Typed user-table rows of a bound hosted tablet.
Sourcepub async fn bind_tablet_user_table(
&self,
tablet_id: TabletId,
binding: TabletTableBinding,
) -> Result<TabletTableBinding, ClusterRuntimeError>
pub async fn bind_tablet_user_table( &self, tablet_id: TabletId, binding: TabletTableBinding, ) -> Result<TabletTableBinding, ClusterRuntimeError>
Bind a hosted tablet to a typed user-table schema (P0.3).
Sourcepub async fn tablet_table_binding(
&self,
tablet_id: TabletId,
) -> Result<Option<TabletTableBinding>, ClusterRuntimeError>
pub async fn tablet_table_binding( &self, tablet_id: TabletId, ) -> Result<Option<TabletTableBinding>, ClusterRuntimeError>
Current typed binding for a hosted tablet, if any.
Sourcepub async fn write_tablet_rows(
&self,
tablet_id: TabletId,
entries: &[(Key, Vec<u8>)],
) -> Result<GroupCommitReceipt, ClusterRuntimeError>
pub async fn write_tablet_rows( &self, tablet_id: TabletId, entries: &[(Key, Vec<u8>)], ) -> Result<GroupCommitReceipt, ClusterRuntimeError>
Raft-propose upserts into a hosted tablet’s opaque MVCC keyspace.
The local replica must be the group leader; [ConsensusError::NotLeader]
surfaces through ClusterRuntimeError::Runtime with a leader hint.
Sourcepub async fn write_tablet_ops(
&self,
tablet_id: TabletId,
operations: Vec<TabletWriteOperation>,
) -> Result<GroupCommitReceipt, ClusterRuntimeError>
pub async fn write_tablet_ops( &self, tablet_id: TabletId, operations: Vec<TabletWriteOperation>, ) -> Result<GroupCommitReceipt, ClusterRuntimeError>
Raft-propose typed user-table mutations (COMMAND_TYPE_TABLET_WRITE).
Sourcepub async fn shutdown(&self) -> Result<(), ClusterRuntimeError>
pub async fn shutdown(&self) -> Result<(), ClusterRuntimeError>
Graceful shutdown: stop the runtime once. Additional calls are no-ops.
Trait Implementations§
Source§impl Clone for ClusterRuntimeHandle
impl Clone for ClusterRuntimeHandle
Source§fn clone(&self) -> ClusterRuntimeHandle
fn clone(&self) -> ClusterRuntimeHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ClusterRuntimeHandle
impl !UnwindSafe for ClusterRuntimeHandle
impl Freeze for ClusterRuntimeHandle
impl Send for ClusterRuntimeHandle
impl Sync for ClusterRuntimeHandle
impl Unpin for ClusterRuntimeHandle
impl UnsafeUnpin for ClusterRuntimeHandle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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> 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>
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>
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 moreSource§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