pub struct LifecycleManager {
handlers: Arc<RwLock<HashMap<String, LifecycleHandlerInfo>>>,
states: Arc<RwLock<HashMap<String, LifecycleState>>>,
event_history: Arc<RwLock<Vec<LifecycleEventRecord>>>,
}Expand description
Lifecycle manager for extension lifecycle
Fields§
§handlers: Arc<RwLock<HashMap<String, LifecycleHandlerInfo>>>Event handlers
states: Arc<RwLock<HashMap<String, LifecycleState>>>Extension states
event_history: Arc<RwLock<Vec<LifecycleEventRecord>>>Event history
Implementations§
Source§impl LifecycleManager
impl LifecycleManager
Sourcepub async fn register_extension(
&self,
extension_id: &str,
initial_state: LifecycleState,
) -> Result<()>
pub async fn register_extension( &self, extension_id: &str, initial_state: LifecycleState, ) -> Result<()>
Register an extension for lifecycle management
Sourcepub async fn unregister_extension(&self, extension_id: &str) -> Result<()>
pub async fn unregister_extension(&self, extension_id: &str) -> Result<()>
Unregister an extension from lifecycle management
Sourcepub async fn get_state(&self, extension_id: &str) -> Option<LifecycleState>
pub async fn get_state(&self, extension_id: &str) -> Option<LifecycleState>
Get the current state of an extension
Sourcepub async fn transition(
&self,
extension_id: &str,
event: LifecycleEvent,
) -> Result<LifecycleState>
pub async fn transition( &self, extension_id: &str, event: LifecycleEvent, ) -> Result<LifecycleState>
Transition an extension to a new state
Sourcefn determine_next_state(
&self,
current_state: LifecycleState,
event: LifecycleEvent,
) -> Result<LifecycleState>
fn determine_next_state( &self, current_state: LifecycleState, event: LifecycleEvent, ) -> Result<LifecycleState>
Determine the next state based on current state and event
Sourceasync fn perform_state_transition(
&self,
extension_id: &str,
event: LifecycleEvent,
new_state: LifecycleState,
) -> Result<()>
async fn perform_state_transition( &self, extension_id: &str, event: LifecycleEvent, new_state: LifecycleState, ) -> Result<()>
Perform actual state transition
Sourcepub async fn trigger_event(
&self,
extension_id: &str,
event: LifecycleEvent,
) -> Result<()>
pub async fn trigger_event( &self, extension_id: &str, event: LifecycleEvent, ) -> Result<()>
Trigger a lifecycle event for an extension
Sourcepub async fn get_event_history(&self) -> Vec<LifecycleEventRecord>
pub async fn get_event_history(&self) -> Vec<LifecycleEventRecord>
Get event history
Sourcepub async fn get_event_history_for_extension(
&self,
extension_id: &str,
) -> Vec<LifecycleEventRecord>
pub async fn get_event_history_for_extension( &self, extension_id: &str, ) -> Vec<LifecycleEventRecord>
Get event history for a specific extension
Sourcepub async fn get_registered_extensions(&self) -> Vec<String>
pub async fn get_registered_extensions(&self) -> Vec<String>
Get all registered extensions
Sourcepub async fn get_extensions_in_state(
&self,
state: LifecycleState,
) -> Vec<String>
pub async fn get_extensions_in_state( &self, state: LifecycleState, ) -> Vec<String>
Get extensions in a specific state
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LifecycleManager
impl !RefUnwindSafe for LifecycleManager
impl Send for LifecycleManager
impl Sync for LifecycleManager
impl Unpin for LifecycleManager
impl !UnwindSafe for LifecycleManager
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 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>
Wrap the input message
T in a tonic::Request