Expand description
Content lifecycle event system for webhooks and callbacks.
This module provides an event-driven system for tracking content lifecycle operations. Applications can register event handlers to react to content additions, accesses, removals, and other lifecycle events.
§Example
use chie_core::lifecycle::{LifecycleEventManager, LifecycleEventType, ContentEvent};
#[tokio::main]
async fn main() {
let mut manager = LifecycleEventManager::new();
// Register an event handler
manager.on(LifecycleEventType::ContentAdded, |event| {
println!("Content added: {}", event.cid);
});
// Emit an event
manager.emit(ContentEvent {
cid: "QmExample".to_string(),
event_type: LifecycleEventType::ContentAdded,
size_bytes: Some(1024),
peer_id: None,
metadata: None,
}).await;
}Structs§
- Content
Event - A content lifecycle event.
- Event
History Entry - Event history entry.
- Lifecycle
Event Manager - Lifecycle event manager for handling content events.
- Webhook
Config - Webhook configuration for HTTP callbacks.
Enums§
- Lifecycle
Event Type - Type of lifecycle event.
Type Aliases§
- Event
Handler - Type alias for event handler functions.