//! Queue adapter system for work queue abstraction. //! //! This module provides a generic trait and implementations for queue adapters //! that can be used with any work type for handle resolution and other tasks. //! //! # Architecture //! //! The queue system is designed with the following components: //! //! - **Trait**: `QueueAdapter` - Common interface for all queue implementations //! - **Implementations**: //! - `MpscQueueAdapter` - In-memory MPSC channel-based queue //! - `RedisQueueAdapter` - Distributed Redis-backed queue //! - `SqliteQueueAdapter` - Persistent SQLite-backed queue //! - `NoopQueueAdapter` - No-operation queue for testing //! - **Work Types**: `HandleResolutionWork` - Work items for handle resolution //! - **Factory Functions**: Convenient functions for creating queue adapters //! //! # Examples //! //! ## Simple In-Memory Queue //! //! ``` //! use quickdid::queue::{create_mpsc_queue, QueueAdapter}; //! //! # async fn example() -> anyhow::Result<()> { //! let queue = create_mpsc_queue::(100); //! //! queue.push("work-item".to_string()).await?; //! if let Some(item) = queue.pull().await { //! println!("Processing: {}", item); //! } //! # Ok(()) //! # } //! ``` //! //! ## Persistent Queue with Work Shedding //! //! ```no_run //! use quickdid::queue::{create_sqlite_queue_with_max_size, HandleResolutionWork}; //! use quickdid::sqlite_schema::create_sqlite_pool; //! //! # async fn example() -> anyhow::Result<()> { //! let pool = create_sqlite_pool("sqlite:./quickdid.db").await?; //! let queue = create_sqlite_queue_with_max_size::(pool, 10000); //! //! let work = HandleResolutionWork::new("alice.bsky.social".to_string()); //! queue.push(work).await?; //! # Ok(()) //! # } //! ``` // Internal modules mod adapter; mod error; mod factory; mod mpsc; mod noop; mod redis; mod sqlite; mod work; // Re-export core types pub use adapter::QueueAdapter; pub use error::{QueueError, Result}; pub use work::{DedupKey, HandleResolutionWork}; // Re-export implementations (with limited visibility) pub use mpsc::MpscQueueAdapter; pub use noop::NoopQueueAdapter; pub use redis::RedisQueueAdapter; pub use sqlite::SqliteQueueAdapter; // Re-export factory functions pub use factory::{ create_mpsc_queue, create_mpsc_queue_from_channel, create_noop_queue, create_redis_queue, create_redis_queue_with_dedup, create_sqlite_queue, create_sqlite_queue_with_max_size, };