pub struct StopHandler {
sync: Option<SyncService>,
auto_sync: bool,
timeout_ms: u64,
}Expand description
Handles Stop hook events.
Performs session analysis and sync at session end. Includes timeout enforcement to prevent hanging (RES-M2).
Fields§
§sync: Option<SyncService>Sync service.
auto_sync: boolWhether to auto-sync on stop.
timeout_ms: u64Timeout for stop hook operations in milliseconds.
Implementations§
Source§impl StopHandler
impl StopHandler
Sourcepub const fn with_timeout_ms(self, timeout_ms: u64) -> Self
pub const fn with_timeout_ms(self, timeout_ms: u64) -> Self
Sets the timeout in milliseconds.
Operations that exceed this timeout will return a partial response.
Sourcepub fn with_sync(self, sync: SyncService) -> Self
pub fn with_sync(self, sync: SyncService) -> Self
Sets the sync service.
Sourcepub const fn with_auto_sync(self, enabled: bool) -> Self
pub const fn with_auto_sync(self, enabled: bool) -> Self
Enables or disables auto-sync.
Sourcefn generate_summary(&self, input: &Value) -> SessionSummary
fn generate_summary(&self, input: &Value) -> SessionSummary
Generates a session summary.
Sourcefn extract_namespace_counts(input: &Value) -> HashMap<String, NamespaceStats>
fn extract_namespace_counts(input: &Value) -> HashMap<String, NamespaceStats>
Extracts namespace statistics from input.
Extracts tags used with frequencies, sorted by count descending.
Sourcefn extract_query_patterns(input: &Value) -> Vec<String>
fn extract_query_patterns(input: &Value) -> Vec<String>
Extracts query patterns from the session.
Sourcefn extract_resources_read(input: &Value) -> Vec<String>
fn extract_resources_read(input: &Value) -> Vec<String>
Extracts MCP resources read during the session.
Sourcefn perform_sync(&self) -> Option<SyncResult>
fn perform_sync(&self) -> Option<SyncResult>
Performs sync if enabled and available.
Sourcefn build_metadata(
summary: &SessionSummary,
sync_result: Option<&SyncResult>,
) -> Value
fn build_metadata( summary: &SessionSummary, sync_result: Option<&SyncResult>, ) -> Value
Builds metadata JSON from session summary.
Sourcefn build_context_lines(
summary: &SessionSummary,
sync_result: Option<&SyncResult>,
) -> String
fn build_context_lines( summary: &SessionSummary, sync_result: Option<&SyncResult>, ) -> String
Builds context message lines from session summary.
Trait Implementations§
Source§impl Default for StopHandler
impl Default for StopHandler
Source§impl HookHandler for StopHandler
impl HookHandler for StopHandler
Auto Trait Implementations§
impl Freeze for StopHandler
impl RefUnwindSafe for StopHandler
impl Send for StopHandler
impl Sync for StopHandler
impl Unpin for StopHandler
impl UnwindSafe for StopHandler
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].