use std::sync::Arc; use bson::Document; use dashmap::DashMap; use rustdb_index::IndexEngine; use rustdb_storage::StorageAdapter; use rustdb_txn::{SessionEngine, TransactionEngine}; /// Shared command execution context, passed to all handlers. pub struct CommandContext { /// The storage backend. pub storage: Arc, /// Index engines per namespace: "db.collection" -> IndexEngine. pub indexes: Arc>, /// Transaction engine for multi-document transactions. pub transactions: Arc, /// Session engine for logical sessions. pub sessions: Arc, /// Active cursors for getMore / killCursors. pub cursors: Arc>, /// Server start time (for uptime reporting). pub start_time: std::time::Instant, } /// State of an open cursor from a find or aggregate command. pub struct CursorState { /// Documents remaining to be returned. pub documents: Vec, /// Current read position within `documents`. pub position: usize, /// Database the cursor belongs to. pub database: String, /// Collection the cursor belongs to. pub collection: String, }