use std::sync::Arc;
use crate::error::Result;
use crate::sql::types::{Row, Value};
use crate::storage::schema::TableSchema;
pub trait StorageEngine: Send + Sync {
fn create_table(&self, schema: &TableSchema) -> Result<()>;
fn drop_table(&self, name: &str) -> Result<()>;
fn get_schema(&self, name: &str) -> Result<Option<TableSchema>>;
fn list_tables(&self) -> Result<Vec<String>>;
fn insert_row(&self, table: &str, row: Row) -> Result<()>;
fn get_row(&self, table: &str, pk: &Value) -> Result<Option<Row>>;
fn scan_table(&self, table: &str) -> Result<Vec<Row>>;
fn update_row(&self, table: &str, pk: &Value, row: Row) -> Result<()>;
fn delete_row(&self, table: &str, pk: &Value) -> Result<bool>;
fn row_count(&self, table: &str) -> Result<u64>;
fn table_exists(&self, name: &str) -> Result<bool>;
fn update_schema(&self, schema: &TableSchema) -> Result<()>;
}
pub type SharedEngine = Arc<dyn StorageEngine>;