pub struct WebhookRegistry { /* private fields */ }Expand description
In-memory registry of webhook registrations, backed by ContextStore for durability.
Implementations§
Source§impl WebhookRegistry
impl WebhookRegistry
Sourcepub fn load_from_store(store: &dyn ContextStore) -> Result<Self, WebhookError>
pub fn load_from_store(store: &dyn ContextStore) -> Result<Self, WebhookError>
Load all webhook registrations from ContextStore.
Called at daemon startup to restore registrations from the previous session.
Sourcepub fn register(
&mut self,
registration: WebhookRegistration,
store: &dyn ContextStore,
) -> Result<(), WebhookError>
pub fn register( &mut self, registration: WebhookRegistration, store: &dyn ContextStore, ) -> Result<(), WebhookError>
Register a new webhook. Returns error if the path is already registered.
Sourcepub fn remove(
&mut self,
id: WebhookId,
store: &dyn ContextStore,
) -> Result<WebhookRegistration, WebhookError>
pub fn remove( &mut self, id: WebhookId, store: &dyn ContextStore, ) -> Result<WebhookRegistration, WebhookError>
Remove a webhook by ID. Returns the removed registration, or error if not found.
Sourcepub fn get_by_path(&self, path: &str) -> Option<&WebhookRegistration>
pub fn get_by_path(&self, path: &str) -> Option<&WebhookRegistration>
Look up a webhook by path. Used by the catch-all webhook handler.
Sourcepub fn by_id_to_path(&self, id: &WebhookId) -> Option<&str>
pub fn by_id_to_path(&self, id: &WebhookId) -> Option<&str>
Look up the path for a webhook ID.
Sourcepub fn list(&self) -> Vec<&WebhookRegistration>
pub fn list(&self) -> Vec<&WebhookRegistration>
List all registered webhooks, sorted by creation time.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WebhookRegistry
impl RefUnwindSafe for WebhookRegistry
impl Send for WebhookRegistry
impl Sync for WebhookRegistry
impl Unpin for WebhookRegistry
impl UnsafeUnpin for WebhookRegistry
impl UnwindSafe for WebhookRegistry
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