pub struct SchemaManager { /* private fields */ }Implementations§
Source§impl SchemaManager
impl SchemaManager
pub async fn load(path: impl AsRef<Path>) -> Result<Self>
pub async fn load_from_store( store: Arc<dyn ObjectStore>, path: &ObjectStorePath, ) -> Result<Self>
pub async fn save(&self) -> Result<()>
pub fn path(&self) -> &ObjectStorePath
pub fn schema(&self) -> Arc<Schema>
Sourcepub fn generated_column_name(expr: &str) -> String
pub fn generated_column_name(expr: &str) -> String
Generate a consistent internal column name for an expression index. Uses a hash suffix to ensure uniqueness for different expressions that might sanitize to the same string (e.g., “a+b” and “a-b” both become “a_b”).
IMPORTANT: Uses FNV-1a hash which is stable across Rust versions and platforms. DefaultHasher is not guaranteed to be stable and could break persistent data if the hash changes after a compiler upgrade.
pub fn replace_schema(&self, new_schema: Schema)
Sourcepub fn with_overlay(&self, overlay: &SchemaDelta) -> Arc<Self>
pub fn with_overlay(&self, overlay: &SchemaDelta) -> Arc<Self>
Build a fork-scoped manager whose schema is primary ⊕ overlay.
Used by UniInner::at_fork to give a forked session a schema view
that includes any labels/edge-types/properties the fork has
introduced on top of primary. The returned manager owns its own
in-memory Arc<Schema> — mutations to it never reach primary’s
schema file. The returned manager is not intended for .save();
fork-overlay persistence is owned by the registry layer
(catalog/fork_schemas/{fork_id}.json).
In Phase 1 the delta is always empty, so the merge is a clone. Phase 2 starts populating it when on-the-fly label creation lands.
pub fn next_label_id(&self) -> u16
pub fn next_type_id(&self) -> u32
pub fn add_label(&self, name: &str) -> Result<u16>
pub fn add_label_with_desc( &self, name: &str, description: Option<String>, ) -> Result<u16>
pub fn add_edge_type( &self, name: &str, src_labels: Vec<String>, dst_labels: Vec<String>, ) -> Result<u32>
pub fn add_edge_type_with_desc( &self, name: &str, src_labels: Vec<String>, dst_labels: Vec<String>, description: Option<String>, ) -> Result<u32>
Sourcepub fn get_or_assign_edge_type_id(&self, type_name: &str) -> u32
pub fn get_or_assign_edge_type_id(&self, type_name: &str) -> u32
Delegates to Schema::get_or_assign_edge_type_id.
Sourcepub fn edge_type_name_by_id_unified(&self, type_id: u32) -> Option<String>
pub fn edge_type_name_by_id_unified(&self, type_id: u32) -> Option<String>
Delegates to Schema::edge_type_name_by_id_unified.
pub fn add_property( &self, label_or_type: &str, prop_name: &str, data_type: DataType, nullable: bool, ) -> Result<()>
pub fn add_property_with_desc( &self, label_or_type: &str, prop_name: &str, data_type: DataType, nullable: bool, description: Option<String>, ) -> Result<()>
pub fn add_generated_property( &self, label_or_type: &str, prop_name: &str, data_type: DataType, expr: String, ) -> Result<()>
pub fn set_label_description( &self, name: &str, description: Option<String>, ) -> Result<()>
pub fn set_edge_type_description( &self, name: &str, description: Option<String>, ) -> Result<()>
pub fn set_property_description( &self, entity: &str, prop_name: &str, description: Option<String>, ) -> Result<()>
Sourcepub fn add_index(&self, index_def: IndexDefinition) -> Result<()>
pub fn add_index(&self, index_def: IndexDefinition) -> Result<()>
Register an index definition on the schema, upsert by name.
If an index with the same IndexDefinition::name() already exists, it
is replaced in place; otherwise the def is appended. Idempotent under
repeat invocation, which makes SchemaBuilder::apply() re-applicable
without bloating schema.indexes and lets the rebuild epilogue inside
every IndexManager::create_*_index re-record metadata updates without
duplicating entries (issue rustic-ai/uni-db#63).
pub fn get_index(&self, name: &str) -> Option<IndexDefinition>
Sourcepub fn update_index_metadata(
&self,
index_name: &str,
f: impl FnOnce(&mut IndexMetadata),
) -> Result<()>
pub fn update_index_metadata( &self, index_name: &str, f: impl FnOnce(&mut IndexMetadata), ) -> Result<()>
Updates the lifecycle metadata for an index by name.
The closure receives a mutable reference to the index’s IndexMetadata,
allowing callers to update status, timestamps, etc.
pub fn remove_index(&self, name: &str) -> Result<()>
pub fn add_constraint(&self, constraint: Constraint) -> Result<()>
pub fn drop_constraint(&self, name: &str, if_exists: bool) -> Result<()>
pub fn drop_property(&self, label_or_type: &str, prop_name: &str) -> Result<()>
pub fn rename_property( &self, label_or_type: &str, old_name: &str, new_name: &str, ) -> Result<()>
pub fn drop_label(&self, name: &str, if_exists: bool) -> Result<()>
pub fn drop_edge_type(&self, name: &str, if_exists: bool) -> Result<()>
Auto Trait Implementations§
impl !Freeze for SchemaManager
impl !RefUnwindSafe for SchemaManager
impl !UnwindSafe for SchemaManager
impl Send for SchemaManager
impl Sync for SchemaManager
impl Unpin for SchemaManager
impl UnsafeUnpin for SchemaManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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