pub struct StorageEngine { /* private fields */ }Expand description
Main storage engine that coordinates all storage components
NOTE: Issue #176 removed write infrastructure (compaction, manifest). This is now a read-only storage layer focused on SSTable access.
Implementations§
Source§impl StorageEngine
impl StorageEngine
Sourcepub async fn open(
path: &Path,
config: &Config,
platform: Arc<Platform>,
schema_registry: Option<Arc<RwLock<SchemaRegistry>>>,
) -> Result<Self>
pub async fn open( path: &Path, config: &Config, platform: Arc<Platform>, schema_registry: Option<Arc<RwLock<SchemaRegistry>>>, ) -> Result<Self>
Open a storage engine at the given path
This method discovers SSTables by scanning the storage directory.
For pre-discovered SSTables, use open_with_sstables instead.
NOTE: Issue #176 removed write infrastructure (compaction, manifest). This is now a read-only storage layer focused on SSTable access.
Sourcepub async fn open_with_sstables(
path: &Path,
discovered_table_dirs: Vec<PathBuf>,
config: &Config,
platform: Arc<Platform>,
schema_registry: Option<Arc<RwLock<SchemaRegistry>>>,
) -> Result<Self>
pub async fn open_with_sstables( path: &Path, discovered_table_dirs: Vec<PathBuf>, config: &Config, platform: Arc<Platform>, schema_registry: Option<Arc<RwLock<SchemaRegistry>>>, ) -> Result<Self>
Open a storage engine with pre-discovered SSTable table directories
This method is used when SSTables have been discovered externally (e.g., by DiscoveryService) and allows the storage engine to be initialized with specific table directories rather than scanning the storage directory. Each table directory will be scanned for Data.db files.
§Arguments
path- Base storage path for manifest and SSTable operationsdiscovered_table_dirs- Vector of table directory paths (each containing SSTable files)config- Storage configurationplatform- Platform abstraction for I/O operations
§Returns
A StorageEngine instance with all components initialized, including SSTable readers for all Data.db files found in the discovered table directories.
§Example
let config = Config::default();
let platform = Arc::new(Platform::new(&config).await?);
let storage_path = Path::new("/var/lib/cqlite/storage");
let discovered_table_dirs = vec![
PathBuf::from("/var/lib/cassandra/keyspace1/table1-abc123"),
PathBuf::from("/var/lib/cassandra/keyspace1/table2-def456"),
];
let engine = StorageEngine::open_with_sstables(
storage_path,
discovered_table_dirs,
&config,
platform,
#[cfg(feature = "state_machine")]
None,
).await?;Sourcepub async fn get(
&self,
table_id: &TableId,
key: &RowKey,
) -> Result<Option<Value>>
pub async fn get( &self, table_id: &TableId, key: &RowKey, ) -> Result<Option<Value>>
Get a value by key
Sourcepub async fn scan(
&self,
table_id: &TableId,
start_key: Option<&RowKey>,
end_key: Option<&RowKey>,
limit: Option<usize>,
schema: Option<&TableSchema>,
) -> Result<Vec<(RowKey, Value)>>
pub async fn scan( &self, table_id: &TableId, start_key: Option<&RowKey>, end_key: Option<&RowKey>, limit: Option<usize>, schema: Option<&TableSchema>, ) -> Result<Vec<(RowKey, Value)>>
Scan a range of keys
§Arguments
table_id- The table to scanstart_key- Optional start key for range scanend_key- Optional end key for range scanlimit- Optional limit on number of resultsschema- Optional table schema for schema-aware parsing. When provided, enables accurate type detection and avoids heuristic-based parsing. Strongly recommended for Cassandra 5.0+ formats.
Sourcepub async fn stats(&self) -> Result<StorageStats>
pub async fn stats(&self) -> Result<StorageStats>
Get storage statistics
NOTE: Issue #176 removed compaction stats (compaction.rs deleted).
Sourcepub async fn shutdown(&self) -> Result<()>
pub async fn shutdown(&self) -> Result<()>
Shutdown the storage engine
NOTE: Issue #176 removed compaction shutdown (compaction.rs deleted). Issue #175 removed flush operations (WAL/MemTable deleted).
Sourcepub async fn set_schema_registry(
&self,
registry: Arc<RwLock<SchemaRegistry>>,
) -> Result<()>
pub async fn set_schema_registry( &self, registry: Arc<RwLock<SchemaRegistry>>, ) -> Result<()>
Set the schema registry for schema-aware operations
This method propagates the schema registry to the SSTable manager, which will apply it to all SSTable readers for schema-aware parsing.