pub struct NotificationSender { /* private fields */ }Expand description
Centralized notification sender for database operations
Handles the common 3-step pattern:
- Create ProtocolMessage from payload
- Serialize to JSON
- Send via both WebSocket (Dashboard UI) and MCP channels
Implementations§
Source§impl NotificationSender
impl NotificationSender
Sourcepub fn new(
ws_state: Option<Arc<WebSocketState>>,
mcp_notifier: Option<UnboundedSender<String>>,
) -> Self
pub fn new( ws_state: Option<Arc<WebSocketState>>, mcp_notifier: Option<UnboundedSender<String>>, ) -> Self
Create a new NotificationSender
§Arguments
ws_state- Optional WebSocket state for Dashboard UI notificationsmcp_notifier- Optional MCP channel for MCP client notifications
Sourcepub async fn send(&self, payload: DatabaseOperationPayload)
pub async fn send(&self, payload: DatabaseOperationPayload)
Send a database operation notification via all available channels
This method handles:
- Creating a ProtocolMessage wrapper
- Serializing to JSON (with error handling)
- Broadcasting to Dashboard WebSocket (if connected)
- Sending to MCP channel (if connected)
§Arguments
payload- The database operation payload to send
Auto Trait Implementations§
impl Freeze for NotificationSender
impl !RefUnwindSafe for NotificationSender
impl Send for NotificationSender
impl Sync for NotificationSender
impl Unpin for NotificationSender
impl !UnwindSafe for NotificationSender
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
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>
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