pub struct AdminApiService { /* private fields */ }Expand description
AdminApiService — canonical business-logic layer for node administration.
Both the REST/BFF (admin_api.rs) and the gRPC NodeAdminService trait call
into the *_direct() methods defined here. REST handlers should be thin
wrappers that parse the request and format the JSON response.
Implementations§
Source§impl AdminApiService
impl AdminApiService
Sourcepub fn new(
node_id: impl Into<String>,
name: impl Into<String>,
location_tag: impl Into<String>,
version: impl Into<String>,
service_collector: ServiceCollector,
) -> AdminResult<Self>
pub fn new( node_id: impl Into<String>, name: impl Into<String>, location_tag: impl Into<String>, version: impl Into<String>, service_collector: ServiceCollector, ) -> AdminResult<Self>
Create a new control gRPC service instance.
Sourcepub fn with_metrics_provider<F, Fut>(self, provider: F) -> Selfwhere
F: Fn() -> Fut + Send + Sync + 'static,
Fut: Future<Output = AdminResult<SystemMetrics>> + Send + 'static,
pub fn with_metrics_provider<F, Fut>(self, provider: F) -> Selfwhere
F: Fn() -> Fut + Send + Sync + 'static,
Fut: Future<Output = AdminResult<SystemMetrics>> + Send + 'static,
Override the metrics provider used by GetNodeInfo.
Sourcepub fn with_shutdown_handler<F, Fut>(self, handler: F) -> Self
pub fn with_shutdown_handler<F, Fut>(self, handler: F) -> Self
Attach a shutdown handler invoked when Shutdown is accepted.
Sourcepub fn with_override_store(self, store: Arc<ConfigOverrideStore>) -> Self
pub fn with_override_store(self, store: Arc<ConfigOverrideStore>) -> Self
Attach a SQLite-backed config override store for L2 dynamic overrides.
Sourcepub fn with_reload_handler<F, Fut>(self, handler: F) -> Self
pub fn with_reload_handler<F, Fut>(self, handler: F) -> Self
Attach a reload handler invoked when reload is requested.
Sourcepub fn with_running_config(self, config: ActrixConfig) -> Self
pub fn with_running_config(self, config: ActrixConfig) -> Self
Attach the runtime config snapshot (AdminUi head mode).
Sourcepub fn with_toml_content(self, content: String) -> Self
pub fn with_toml_content(self, content: String) -> Self
Attach the raw TOML content for L1 detection.
Sourcepub fn with_config_path(self, path: PathBuf) -> Self
pub fn with_config_path(self, path: PathBuf) -> Self
Attach the config file path.
Sourcepub fn override_store(&self) -> Option<&Arc<ConfigOverrideStore>>
pub fn override_store(&self) -> Option<&Arc<ConfigOverrideStore>>
Get the override store reference.
Sourcepub async fn service_statuses(&self) -> Vec<ServiceStatus>
pub async fn service_statuses(&self) -> Vec<ServiceStatus>
Collect current service statuses for this node.
Returns all service statuses from the service registry.
Sourcepub async fn resolve_node_name(&self) -> String
pub async fn resolve_node_name(&self) -> String
Resolve the effective node name (L2 override → L1 config → running).
Sourcepub async fn health_info(&self) -> HealthInfo
pub async fn health_info(&self) -> HealthInfo
Health check info.
Sourcepub async fn list_overrides_direct(&self) -> Result<Vec<ConfigOverride>, Status>
pub async fn list_overrides_direct(&self) -> Result<Vec<ConfigOverride>, Status>
List L2 dynamic config overrides.
Sourcepub async fn set_override_direct(
&self,
key: &str,
value: &str,
by: &str,
) -> Result<(), Status>
pub async fn set_override_direct( &self, key: &str, value: &str, by: &str, ) -> Result<(), Status>
Set a dynamic config override.
Sourcepub async fn delete_override_direct(&self, key: &str) -> Result<bool, Status>
pub async fn delete_override_direct(&self, key: &str) -> Result<bool, Status>
Delete a dynamic config override.
Sourcepub async fn get_platform_detail_direct(&self) -> Result<PlatformDetail, Status>
pub async fn get_platform_detail_direct(&self) -> Result<PlatformDetail, Status>
Get platform detail with resolved config fields.
Sourcepub async fn get_service_detail_direct(
&self,
name: &str,
) -> Result<ServiceDetail, Status>
pub async fn get_service_detail_direct( &self, name: &str, ) -> Result<ServiceDetail, Status>
Get service detail with resolved config fields.
Sourcepub fn get_registry_direct(&self) -> &'static [ConfigFieldDef]
pub fn get_registry_direct(&self) -> &'static [ConfigFieldDef]
Get config registry (all field definitions).
Sourcepub async fn get_config_file_direct(&self) -> Result<ConfigFileContent, Status>
pub async fn get_config_file_direct(&self) -> Result<ConfigFileContent, Status>
Read config file from disk.
Sourcepub async fn save_config_file_direct(&self, content: &str) -> Result<(), Status>
pub async fn save_config_file_direct(&self, content: &str) -> Result<(), Status>
Write config file to disk (with TOML validation).
Sourcepub async fn reload_direct(&self) -> Result<bool, Status>
pub async fn reload_direct(&self) -> Result<bool, Status>
Trigger reload (SIGHUP).
Sourcepub async fn get_signer_keys_direct(&self) -> Result<KsKeysResult, Status>
pub async fn get_signer_keys_direct(&self) -> Result<KsKeysResult, Status>
Query Signer keys from the SQLite database.
Sourcepub async fn cleanup_signer_keys_direct(
&self,
) -> Result<KsCleanupResult, Status>
pub async fn cleanup_signer_keys_direct( &self, ) -> Result<KsCleanupResult, Status>
Cleanup expired Signer keys.
Sourcepub async fn get_ais_keys_direct(&self) -> Result<Vec<KeyInfo>, Status>
pub async fn get_ais_keys_direct(&self) -> Result<Vec<KeyInfo>, Status>
Query AIS keys from the SQLite database.
Sourcepub async fn node_info_direct(&self) -> Result<GetNodeInfoResponse, Status>
pub async fn node_info_direct(&self) -> Result<GetNodeInfoResponse, Status>
Get node info including metrics and service statuses.
Sourcepub async fn list_realms_direct(&self) -> Result<ListRealmsResponse, Status>
pub async fn list_realms_direct(&self) -> Result<ListRealmsResponse, Status>
List all realms.
Sourcepub async fn create_realm_with_secret_direct(
&self,
req: CreateRealmRequest,
) -> Result<(CreateRealmResponse, Option<String>), Status>
pub async fn create_realm_with_secret_direct( &self, req: CreateRealmRequest, ) -> Result<(CreateRealmResponse, Option<String>), Status>
Create a realm and return the plaintext realm secret once.
Sourcepub async fn create_realm_direct(
&self,
req: CreateRealmRequest,
) -> Result<CreateRealmResponse, Status>
pub async fn create_realm_direct( &self, req: CreateRealmRequest, ) -> Result<CreateRealmResponse, Status>
Create a realm (gRPC path, does not expose plaintext secret in response).
Sourcepub async fn get_realm_direct(
&self,
realm_id: u32,
) -> Result<GetRealmResponse, Status>
pub async fn get_realm_direct( &self, realm_id: u32, ) -> Result<GetRealmResponse, Status>
Get a single realm by ID.
Sourcepub async fn update_realm_direct(
&self,
req: UpdateRealmRequest,
) -> Result<UpdateRealmResponse, Status>
pub async fn update_realm_direct( &self, req: UpdateRealmRequest, ) -> Result<UpdateRealmResponse, Status>
Update an existing realm.
Sourcepub async fn delete_realm_direct(
&self,
realm_id: u32,
) -> Result<DeleteRealmResponse, Status>
pub async fn delete_realm_direct( &self, realm_id: u32, ) -> Result<DeleteRealmResponse, Status>
Delete a realm by ID.
Sourcepub async fn delete_realm_hard_direct(
&self,
realm_id: u32,
) -> Result<DeleteRealmResponse, Status>
pub async fn delete_realm_hard_direct( &self, realm_id: u32, ) -> Result<DeleteRealmResponse, Status>
Hard-delete a realm for local Admin UI standalone mode.
Sourcepub async fn rotate_realm_secret_direct(
&self,
realm_id: u32,
) -> Result<RealmSecretRotationResult, Status>
pub async fn rotate_realm_secret_direct( &self, realm_id: u32, ) -> Result<RealmSecretRotationResult, Status>
Rotate realm secret and return plaintext once.
Sourcepub async fn get_config_direct(
&self,
config_type: ConfigType,
config_key: String,
) -> Result<GetConfigResponse, Status>
pub async fn get_config_direct( &self, config_type: ConfigType, config_key: String, ) -> Result<GetConfigResponse, Status>
Get a config value.
Sourcepub async fn update_config_direct(
&self,
config_type: ConfigType,
config_key: String,
config_value: String,
) -> Result<UpdateConfigResponse, Status>
pub async fn update_config_direct( &self, config_type: ConfigType, config_key: String, config_value: String, ) -> Result<UpdateConfigResponse, Status>
Update a config value.
Sourcepub async fn shutdown_direct(
&self,
graceful: bool,
timeout_secs: Option<i32>,
reason: Option<String>,
) -> Result<ShutdownResponse, Status>
pub async fn shutdown_direct( &self, graceful: bool, timeout_secs: Option<i32>, reason: Option<String>, ) -> Result<ShutdownResponse, Status>
Request node shutdown.
Trait Implementations§
Source§impl Clone for AdminApiService
impl Clone for AdminApiService
Source§fn clone(&self) -> AdminApiService
fn clone(&self) -> AdminApiService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl NodeAdminService for AdminApiService
impl NodeAdminService for AdminApiService
Source§fn update_config<'life0, 'async_trait>(
&'life0 self,
request: Request<UpdateConfigRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<UpdateConfigResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_config<'life0, 'async_trait>(
&'life0 self,
request: Request<UpdateConfigRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<UpdateConfigResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_config<'life0, 'async_trait>(
&'life0 self,
request: Request<GetConfigRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<GetConfigResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn create_realm<'life0, 'async_trait>(
&'life0 self,
request: Request<CreateRealmRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<CreateRealmResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_realm<'life0, 'async_trait>(
&'life0 self,
request: Request<CreateRealmRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<CreateRealmResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_realm<'life0, 'async_trait>(
&'life0 self,
request: Request<GetRealmRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<GetRealmResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_realm<'life0, 'async_trait>(
&'life0 self,
request: Request<UpdateRealmRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<UpdateRealmResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_realm<'life0, 'async_trait>(
&'life0 self,
request: Request<DeleteRealmRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<DeleteRealmResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_realms<'life0, 'async_trait>(
&'life0 self,
request: Request<ListRealmsRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<ListRealmsResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_node_info<'life0, 'async_trait>(
&'life0 self,
request: Request<GetNodeInfoRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<GetNodeInfoResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_node_info<'life0, 'async_trait>(
&'life0 self,
request: Request<GetNodeInfoRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<GetNodeInfoResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 self,
request: Request<ShutdownRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<ShutdownResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn list_config_overrides<'life0, 'async_trait>(
&'life0 self,
_request: Request<ListConfigOverridesRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<ListConfigOverridesResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_config_overrides<'life0, 'async_trait>(
&'life0 self,
_request: Request<ListConfigOverridesRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<ListConfigOverridesResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_config_override<'life0, 'async_trait>(
&'life0 self,
request: Request<SetConfigOverrideRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<SetConfigOverrideResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_config_override<'life0, 'async_trait>(
&'life0 self,
request: Request<DeleteConfigOverrideRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<DeleteConfigOverrideResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for AdminApiService
impl !UnwindSafe for AdminApiService
impl Freeze for AdminApiService
impl Send for AdminApiService
impl Sync for AdminApiService
impl Unpin for AdminApiService
impl UnsafeUnpin for AdminApiService
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> 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