pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
Sourcepub fn open(options: Options) -> Result<Self>
pub fn open(options: Options) -> Result<Self>
Opens a database at the specified path.
The path should be a base path or directory. We will create: path.redb (single-file storage for triples, dictionary, temporal data)
pub fn hydrate( &mut self, dictionary_values: Vec<String>, triples: Vec<(StringId, StringId, StringId)>, ) -> Result<()>
Sourcepub fn set_node_property(&mut self, id: u64, json: &str) -> Result<()>
pub fn set_node_property(&mut self, id: u64, json: &str) -> Result<()>
Set node properties from JSON string (converts to FlexBuffers internally)
Sourcepub fn get_node_property(&self, id: u64) -> Result<Option<String>>
pub fn get_node_property(&self, id: u64) -> Result<Option<String>>
Get node properties as JSON string (reads from FlexBuffers and converts)
Sourcepub fn set_edge_property(
&mut self,
s: u64,
p: u64,
o: u64,
json: &str,
) -> Result<()>
pub fn set_edge_property( &mut self, s: u64, p: u64, o: u64, json: &str, ) -> Result<()>
Set edge properties from JSON string (converts to FlexBuffers internally)
Sourcepub fn get_edge_property(
&self,
s: u64,
p: u64,
o: u64,
) -> Result<Option<String>>
pub fn get_edge_property( &self, s: u64, p: u64, o: u64, ) -> Result<Option<String>>
Get edge properties as JSON string (reads from FlexBuffers and converts)
pub fn set_node_property_binary(&mut self, id: u64, value: &[u8]) -> Result<()>
pub fn get_node_property_binary(&self, id: u64) -> Result<Option<Vec<u8>>>
pub fn set_edge_property_binary( &mut self, s: u64, p: u64, o: u64, value: &[u8], ) -> Result<()>
pub fn get_edge_property_binary( &self, s: u64, p: u64, o: u64, ) -> Result<Option<Vec<u8>>>
pub fn flush_indexes(&mut self) -> Result<()>
Sourcepub fn batch_insert(&mut self, triples: &[Triple]) -> Result<usize>
pub fn batch_insert(&mut self, triples: &[Triple]) -> Result<usize>
Insert multiple triples in a single transaction Returns the number of triples actually inserted (excludes duplicates)
Sourcepub fn batch_delete(&mut self, triples: &[Triple]) -> Result<usize>
pub fn batch_delete(&mut self, triples: &[Triple]) -> Result<usize>
Delete multiple triples in a single transaction Returns the number of triples actually deleted
Sourcepub fn batch_add_facts(&mut self, facts: &[Fact<'_>]) -> Result<Vec<Triple>>
pub fn batch_add_facts(&mut self, facts: &[Fact<'_>]) -> Result<Vec<Triple>>
Insert multiple facts in a single optimized transaction Uses cached table handles for maximum performance Returns the triples that were inserted
pub fn add_fact(&mut self, fact: Fact<'_>) -> Result<Triple>
pub fn delete_fact(&mut self, fact: Fact<'_>) -> Result<bool>
pub fn all_triples(&self) -> Vec<Triple>
pub fn resolve_str(&self, id: StringId) -> Result<Option<String>>
pub fn resolve_id(&self, value: &str) -> Result<Option<StringId>>
pub fn intern(&mut self, value: &str) -> Result<u64>
Sourcepub fn bulk_intern(&mut self, values: &[&str]) -> Result<Vec<u64>>
pub fn bulk_intern(&mut self, values: &[&str]) -> Result<Vec<u64>>
Bulk intern strings in a single transaction (order preserving).
pub fn dictionary_size(&self) -> Result<u64>
pub fn execute_query( &mut self, query_string: &str, ) -> Result<Vec<HashMap<String, Value>>>
pub fn execute_query_with_params( &mut self, query_string: &str, params: Option<HashMap<String, Value>>, ) -> Result<Vec<HashMap<String, Value>>>
Sourcepub fn serde_value_to_executor_value(value: Value) -> Value
pub fn serde_value_to_executor_value(value: Value) -> Value
Convert serde_json::Value to executor::Value (public for FFI)
pub fn query(&self, criteria: QueryCriteria) -> HexastoreIter
Sourcepub fn get_store(&self) -> &dyn Hexastore
pub fn get_store(&self) -> &dyn Hexastore
Get a reference to the underlying Hexastore for algorithm operations
pub fn open_cursor(&mut self, criteria: QueryCriteria) -> Result<u64>
pub fn cursor_next( &mut self, cursor_id: u64, batch_size: usize, ) -> Result<(Vec<Triple>, bool)>
pub fn close_cursor(&mut self, cursor_id: u64) -> Result<()>
Sourcepub fn begin_transaction(&mut self) -> Result<()>
pub fn begin_transaction(&mut self) -> Result<()>
Begin a new write transaction
Only one write transaction can be active at a time. All data operations will be buffered until commit().
Sourcepub fn commit_transaction(&mut self) -> Result<()>
pub fn commit_transaction(&mut self) -> Result<()>
Commit the active transaction, making all changes durable
Sourcepub fn abort_transaction(&mut self) -> Result<()>
pub fn abort_transaction(&mut self) -> Result<()>
Abort the active transaction, discarding all changes
Sourcepub fn is_transaction_active(&self) -> bool
pub fn is_transaction_active(&self) -> bool
Check if a transaction is currently active
Sourcepub fn with_transaction<F, R>(&mut self, f: F) -> Result<R>
pub fn with_transaction<F, R>(&mut self, f: F) -> Result<R>
Execute a closure within a transaction, automatically committing on success or aborting on error. This provides RAII-style transaction management.