Something went wrong. Try again.
QuickDID is a high-performance AT Protocol identity resolution service written in Rust. It provides handle-to-DID resolution with Redis-back
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879//! 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::<String>(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::<HandleResolutionWork>(pool, 10000);//!//! let work = HandleResolutionWork::new("alice.bsky.social".to_string());//! queue.push(work).await?;//! # Ok(())//! # }//! ```
// Internal modulesmod adapter;mod error;mod factory;mod mpsc;mod noop;mod redis;mod sqlite;mod work;
// Re-export core typespub 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 functionspub 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,};