Skip to main content

Database

Struct Database 

Source
pub struct Database { /* private fields */ }

Implementations§

Source§

impl Database

Source

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)

Source

pub fn hydrate( &mut self, dictionary_values: Vec<String>, triples: Vec<(StringId, StringId, StringId)>, ) -> Result<()>

Source

pub fn set_node_property(&mut self, id: u64, json: &str) -> Result<()>

Set node properties from JSON string (converts to FlexBuffers internally)

Source

pub fn get_node_property(&self, id: u64) -> Result<Option<String>>

Get node properties as JSON string (reads from FlexBuffers and converts)

Source

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)

Source

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)

Source

pub fn set_node_property_binary(&mut self, id: u64, value: &[u8]) -> Result<()>

Source

pub fn get_node_property_binary(&self, id: u64) -> Result<Option<Vec<u8>>>

Source

pub fn set_edge_property_binary( &mut self, s: u64, p: u64, o: u64, value: &[u8], ) -> Result<()>

Source

pub fn get_edge_property_binary( &self, s: u64, p: u64, o: u64, ) -> Result<Option<Vec<u8>>>

Source

pub fn flush_indexes(&mut self) -> Result<()>

Source

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)

Source

pub fn batch_delete(&mut self, triples: &[Triple]) -> Result<usize>

Delete multiple triples in a single transaction Returns the number of triples actually deleted

Source

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

Source

pub fn add_fact(&mut self, fact: Fact<'_>) -> Result<Triple>

Source

pub fn delete_fact(&mut self, fact: Fact<'_>) -> Result<bool>

Source

pub fn all_triples(&self) -> Vec<Triple>

Source

pub fn resolve_str(&self, id: StringId) -> Result<Option<String>>

Source

pub fn resolve_id(&self, value: &str) -> Result<Option<StringId>>

Source

pub fn intern(&mut self, value: &str) -> Result<u64>

Source

pub fn bulk_intern(&mut self, values: &[&str]) -> Result<Vec<u64>>

Bulk intern strings in a single transaction (order preserving).

Source

pub fn dictionary_size(&self) -> Result<u64>

Source

pub fn execute_query( &mut self, query_string: &str, ) -> Result<Vec<HashMap<String, Value>>>

Source

pub fn execute_query_with_params( &mut self, query_string: &str, params: Option<HashMap<String, Value>>, ) -> Result<Vec<HashMap<String, Value>>>

Source

pub fn serde_value_to_executor_value(value: Value) -> Value

Convert serde_json::Value to executor::Value (public for FFI)

Source

pub fn query(&self, criteria: QueryCriteria) -> HexastoreIter

Source

pub fn get_store(&self) -> &dyn Hexastore

Get a reference to the underlying Hexastore for algorithm operations

Source

pub fn open_cursor(&mut self, criteria: QueryCriteria) -> Result<u64>

Source

pub fn cursor_next( &mut self, cursor_id: u64, batch_size: usize, ) -> Result<(Vec<Triple>, bool)>

Source

pub fn close_cursor(&mut self, cursor_id: u64) -> Result<()>

Source

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().

Source

pub fn commit_transaction(&mut self) -> Result<()>

Commit the active transaction, making all changes durable

Source

pub fn abort_transaction(&mut self) -> Result<()>

Abort the active transaction, discarding all changes

Source

pub fn is_transaction_active(&self) -> bool

Check if a transaction is currently active

Source

pub fn with_transaction<F, R>(&mut self, f: F) -> Result<R>
where F: FnOnce(&mut Self) -> Result<R>,

Execute a closure within a transaction, automatically committing on success or aborting on error. This provides RAII-style transaction management.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.