Module lifecycle

Module lifecycle 

Source
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§

ContentEvent
A content lifecycle event.
EventHistoryEntry
Event history entry.
LifecycleEventManager
Lifecycle event manager for handling content events.
WebhookConfig
Webhook configuration for HTTP callbacks.

Enums§

LifecycleEventType
Type of lifecycle event.

Type Aliases§

EventHandler
Type alias for event handler functions.