pub struct SqliteGraphStore { /* private fields */ }Expand description
SQLite implementation of GraphStore
Integrates with existing openfang-memory schema by adding two tables:
ainl_graph_nodes: stores node payloadsainl_graph_edges: stores graph edges
Implementations§
Source§impl SqliteGraphStore
impl SqliteGraphStore
Sourcepub fn ensure_schema(conn: &Connection) -> Result<(), Error>
pub fn ensure_schema(conn: &Connection) -> Result<(), Error>
Ensure the AINL graph schema exists in the database
Sourcepub fn from_connection(conn: Connection) -> Result<Self, String>
pub fn from_connection(conn: Connection) -> Result<Self, String>
Create from an existing connection (for integration with openfang-memory pool)
Sourcepub fn insert_graph_edge(
&self,
from_id: Uuid,
to_id: Uuid,
label: &str,
) -> Result<(), String>
pub fn insert_graph_edge( &self, from_id: Uuid, to_id: Uuid, label: &str, ) -> Result<(), String>
Insert a directed edge between two node IDs (separate from per-node edge payloads).
Sourcepub fn query_nodes_by_type_since(
&self,
node_type: &str,
since_timestamp: i64,
limit: usize,
) -> Result<Vec<AinlMemoryNode>, String>
pub fn query_nodes_by_type_since( &self, node_type: &str, since_timestamp: i64, limit: usize, ) -> Result<Vec<AinlMemoryNode>, String>
Nodes of a given node_type with timestamp >= since_timestamp, most recent first.
Trait Implementations§
Source§impl GraphStore for SqliteGraphStore
impl GraphStore for SqliteGraphStore
Source§fn write_node(&self, node: &AinlMemoryNode) -> Result<(), String>
fn write_node(&self, node: &AinlMemoryNode) -> Result<(), String>
Persists the full node JSON under id via INSERT OR REPLACE (upsert).
Backfill pattern: read_node → patch fields (e.g. episodic signals) → write_node, preserving loaded edges.
Source§fn query_episodes_since(
&self,
since_timestamp: i64,
limit: usize,
) -> Result<Vec<AinlMemoryNode>, String>
fn query_episodes_since( &self, since_timestamp: i64, limit: usize, ) -> Result<Vec<AinlMemoryNode>, String>
Query episodes since a given timestamp
Source§fn find_by_type(&self, type_name: &str) -> Result<Vec<AinlMemoryNode>, String>
fn find_by_type(&self, type_name: &str) -> Result<Vec<AinlMemoryNode>, String>
Find nodes by type
Source§fn walk_edges(
&self,
from_id: Uuid,
label: &str,
) -> Result<Vec<AinlMemoryNode>, String>
fn walk_edges( &self, from_id: Uuid, label: &str, ) -> Result<Vec<AinlMemoryNode>, String>
Walk edges from a node with a given label
Auto Trait Implementations§
impl !Freeze for SqliteGraphStore
impl !RefUnwindSafe for SqliteGraphStore
impl Send for SqliteGraphStore
impl !Sync for SqliteGraphStore
impl Unpin for SqliteGraphStore
impl UnsafeUnpin for SqliteGraphStore
impl !UnwindSafe for SqliteGraphStore
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