pub struct Catalog {
pub name: String,
pub version: u64,
pub entries: HashMap<String, CatalogEntry>,
pub auto_increment: HashMap<String, u64>,
}Expand description
The Schema Catalog
Fields§
§name: StringDatabase name
version: u64Version number
entries: HashMap<String, CatalogEntry>All catalog entries
auto_increment: HashMap<String, u64>Next auto-increment ID for each table
Implementations§
Source§impl Catalog
impl Catalog
pub fn new(name: impl Into<String>) -> Self
Sourcepub fn create_table(
&mut self,
schema: SochSchema,
root_id: u64,
) -> Result<(), String>
pub fn create_table( &mut self, schema: SochSchema, root_id: u64, ) -> Result<(), String>
Create a new table
Sourcepub fn drop_table(&mut self, name: &str) -> Result<CatalogEntry, String>
pub fn drop_table(&mut self, name: &str) -> Result<CatalogEntry, String>
Drop a table
Sourcepub fn get_table(&self, name: &str) -> Option<&CatalogEntry>
pub fn get_table(&self, name: &str) -> Option<&CatalogEntry>
Get a table schema
Sourcepub fn get_table_mut(&mut self, name: &str) -> Option<&mut CatalogEntry>
pub fn get_table_mut(&mut self, name: &str) -> Option<&mut CatalogEntry>
Get a mutable table entry
Sourcepub fn list_tables(&self) -> Vec<&str>
pub fn list_tables(&self) -> Vec<&str>
List all tables
Sourcepub fn create_index(
&mut self,
name: impl Into<String>,
table_name: &str,
fields: Vec<String>,
unique: bool,
root_id: u64,
) -> Result<(), String>
pub fn create_index( &mut self, name: impl Into<String>, table_name: &str, fields: Vec<String>, unique: bool, root_id: u64, ) -> Result<(), String>
Create an index
Sourcepub fn drop_index(&mut self, name: &str) -> Result<CatalogEntry, String>
pub fn drop_index(&mut self, name: &str) -> Result<CatalogEntry, String>
Drop an index
Sourcepub fn get_indexes(&self, table_name: &str) -> Vec<&CatalogEntry>
pub fn get_indexes(&self, table_name: &str) -> Vec<&CatalogEntry>
Get indexes for a table
Sourcepub fn next_auto_increment(&mut self, table_name: &str) -> u64
pub fn next_auto_increment(&mut self, table_name: &str) -> u64
Get next auto-increment value
Sourcepub fn update_row_count(&mut self, table_name: &str, count: u64)
pub fn update_row_count(&mut self, table_name: &str, count: u64)
Update row count for a table
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, String>
pub fn from_bytes(data: &[u8]) -> Result<Self, String>
Deserialize catalog from bytes
Sourcepub fn create_operation(
&mut self,
name: impl Into<String>,
input_schema: SochSchema,
output_schema: SochSchema,
implementation: OperationImpl,
description: impl Into<String>,
) -> Result<(), String>
pub fn create_operation( &mut self, name: impl Into<String>, input_schema: SochSchema, output_schema: SochSchema, implementation: OperationImpl, description: impl Into<String>, ) -> Result<(), String>
Create an operation (Task 7: MCP Integration)
Sourcepub fn get_operation(&self, name: &str) -> Option<&CatalogEntry>
pub fn get_operation(&self, name: &str) -> Option<&CatalogEntry>
Get an operation
Sourcepub fn list_operations(&self) -> Vec<&CatalogEntry>
pub fn list_operations(&self) -> Vec<&CatalogEntry>
List all operations (for MCP tool discovery)
Sourcepub fn generate_mcp_tools(&self) -> Vec<McpToolDescriptor>
pub fn generate_mcp_tools(&self) -> Vec<McpToolDescriptor>
Generate all MCP tool descriptors
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Catalog
impl<'de> Deserialize<'de> for Catalog
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Catalog
impl RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnwindSafe for Catalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more