pub struct LazySymbolTable { /* private fields */ }Expand description
A symbol table with lazy loading support.
Elements are loaded on-demand from a SchemaLoader, reducing memory usage for large schemas.
Implementations§
Source§impl LazySymbolTable
impl LazySymbolTable
Sourcepub fn new(loader: Arc<dyn SchemaLoader>) -> Self
pub fn new(loader: Arc<dyn SchemaLoader>) -> Self
Create a new lazy symbol table.
§Examples
use tensorlogic_adapters::{LazySymbolTable, FileSchemaLoader};
use std::sync::Arc;
let loader = Arc::new(FileSchemaLoader::new("/tmp/schema"));
let lazy_table = LazySymbolTable::new(loader);Sourcepub fn with_strategy(
loader: Arc<dyn SchemaLoader>,
strategy: LoadStrategy,
) -> Self
pub fn with_strategy( loader: Arc<dyn SchemaLoader>, strategy: LoadStrategy, ) -> Self
Create a lazy table with a specific loading strategy.
Sourcepub fn get_domain(&self, name: &str) -> Result<Option<DomainInfo>>
pub fn get_domain(&self, name: &str) -> Result<Option<DomainInfo>>
Get a domain, loading it if necessary.
Sourcepub fn get_predicate(&self, name: &str) -> Result<Option<PredicateInfo>>
pub fn get_predicate(&self, name: &str) -> Result<Option<PredicateInfo>>
Get a predicate, loading it if necessary.
Sourcepub fn list_domains(&self) -> Result<Vec<String>>
pub fn list_domains(&self) -> Result<Vec<String>>
List all available domains (without loading them).
Sourcepub fn list_predicates(&self) -> Result<Vec<String>>
pub fn list_predicates(&self) -> Result<Vec<String>>
List all available predicates (without loading them).
Sourcepub fn preload_domains(&self, names: &[String]) -> Result<()>
pub fn preload_domains(&self, names: &[String]) -> Result<()>
Preload a batch of domains.
Sourcepub fn preload_predicates(&self, names: &[String]) -> Result<()>
pub fn preload_predicates(&self, names: &[String]) -> Result<()>
Preload a batch of predicates.
Sourcepub fn stats(&self) -> LazyLoadStats
pub fn stats(&self) -> LazyLoadStats
Get loading statistics.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the cache and force reload.
Sourcepub fn loaded_domain_count(&self) -> usize
pub fn loaded_domain_count(&self) -> usize
Get the number of loaded domains.
Sourcepub fn loaded_predicate_count(&self) -> usize
pub fn loaded_predicate_count(&self) -> usize
Get the number of loaded predicates.
Sourcepub fn as_symbol_table(&self) -> Arc<RwLock<SymbolTable>>
pub fn as_symbol_table(&self) -> Arc<RwLock<SymbolTable>>
Get a read-only reference to the loaded symbol table.
Note: This only includes loaded elements.
Auto Trait Implementations§
impl Freeze for LazySymbolTable
impl !RefUnwindSafe for LazySymbolTable
impl Send for LazySymbolTable
impl Sync for LazySymbolTable
impl Unpin for LazySymbolTable
impl !UnwindSafe for LazySymbolTable
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