Expand description
§Storage Service
This module provides the storage abstraction layer for the Search Engine Backend. It handles all interactions with Azure CosmosDB for storing web pages, crawl queues, and search statistics.
§Key Components
StorageService
: Main service for CosmosDB operationsWebPage
: Document structure for indexed web pagesCrawlQueue
: Queue management for crawling operationsSearchStatistic
: Analytics data for search operations
§Usage
use search_engine_backend::{Config, StorageService};
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Arc::new(Config::from_env()?);
let storage = StorageService::new(config).await?;
// Storage service is now ready for use
Ok(())
}
Structs§
- Crawl
Queue - Represents a crawl queue entry for managing web crawling operations.
- GLOBAL_
LOG_ BUFFER - Global log buffer instance
- LogBuffer
- Thread-safe log buffer for capturing application logs
- LogEntry
- Structure to hold captured log entries for display in the dashboard
- Search
Statistic - Represents search analytics and statistics data.
- Storage
Service - Storage service for Azure CosmosDB operations.
- WebPage
- Represents a web page document stored in the database.
Enums§
Constants§
- COSMOS_
API_ 🔒VERSION - Azure Cosmos DB REST API version
- MAX_
LOG_ 🔒ENTRIES - Maximum number of log entries to keep in memory