pub struct ConfigService { /* private fields */ }Expand description
Configuration and secrets service.
Stores configuration values at /kernel/config/{namespace}/{key} and
secrets at /kernel/secrets/{namespace}/{key} (encrypted at rest).
Supports change notification via subscriptions.
Implementations§
Source§impl ConfigService
impl ConfigService
Sourcepub fn new(encryption_key: [u8; 32]) -> Self
pub fn new(encryption_key: [u8; 32]) -> Self
Create a new config service with a given encryption key.
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a config service with a default (zero) encryption key (testing).
Sourcepub fn set(
&self,
namespace: &str,
key: &str,
value: Value,
changed_by: Pid,
) -> Result<(), KernelError>
pub fn set( &self, namespace: &str, key: &str, value: Value, changed_by: Pid, ) -> Result<(), KernelError>
Set a configuration value.
Sourcepub fn delete(
&self,
namespace: &str,
key: &str,
changed_by: Pid,
) -> Result<(), KernelError>
pub fn delete( &self, namespace: &str, key: &str, changed_by: Pid, ) -> Result<(), KernelError>
Delete a configuration value.
Sourcepub fn set_typed(
&self,
namespace: &str,
key: &str,
value: ConfigValue,
changed_by: Pid,
) -> Result<(), KernelError>
pub fn set_typed( &self, namespace: &str, key: &str, value: ConfigValue, changed_by: Pid, ) -> Result<(), KernelError>
Store a typed configuration value.
Sourcepub fn get_typed(&self, namespace: &str, key: &str) -> Option<ConfigEntry>
pub fn get_typed(&self, namespace: &str, key: &str) -> Option<ConfigEntry>
Retrieve a typed configuration entry.
Sourcepub fn list(&self, namespace: &str) -> Vec<ConfigEntry>
pub fn list(&self, namespace: &str) -> Vec<ConfigEntry>
List all typed entries in a namespace.
Sourcepub fn delete_typed(&self, namespace: &str, key: &str, changed_by: Pid) -> bool
pub fn delete_typed(&self, namespace: &str, key: &str, changed_by: Pid) -> bool
Delete a typed configuration entry. Returns true if it existed.
Sourcepub fn subscribe(&self, namespace: &str) -> Arc<RwLock<Vec<ConfigChange>>>
pub fn subscribe(&self, namespace: &str) -> Arc<RwLock<Vec<ConfigChange>>>
Subscribe to changes in a namespace.
Returns a shared reference to the change queue. Callers can read
accumulated changes from the returned Arc<RwLock<Vec<ConfigChange>>>.
Sourcepub fn set_secret(
&self,
namespace: &str,
key: &str,
value: &[u8],
scoped_to: Vec<Pid>,
) -> Result<(), KernelError>
pub fn set_secret( &self, namespace: &str, key: &str, value: &[u8], scoped_to: Vec<Pid>, ) -> Result<(), KernelError>
Store an encrypted secret.
Sourcepub fn get_secret(
&self,
namespace: &str,
key: &str,
requester_pid: Pid,
) -> Result<Vec<u8>, KernelError>
pub fn get_secret( &self, namespace: &str, key: &str, requester_pid: Pid, ) -> Result<Vec<u8>, KernelError>
Retrieve a secret (decrypted). Checks PID authorization and expiry.
Sourcepub fn change_log(&self) -> Vec<ConfigChange>
pub fn change_log(&self) -> Vec<ConfigChange>
Get the change log (for auditing).
Trait Implementations§
Source§impl SystemService for ConfigService
impl SystemService for ConfigService
Source§fn service_type(&self) -> ServiceType
fn service_type(&self) -> ServiceType
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !Freeze for ConfigService
impl !RefUnwindSafe for ConfigService
impl Send for ConfigService
impl Sync for ConfigService
impl Unpin for ConfigService
impl UnsafeUnpin for ConfigService
impl UnwindSafe for ConfigService
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> 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 more