pub struct InMemoryGraphStore { /* private fields */ }Expand description
In-memory GraphStore for tests and benchmarks, with no live backend.
This is the trait’s test/benchmark boundary, letting callers exercise the
graph seam without a running FalkorDB. It does not interpret Cypher — there
is no graph engine here — so GraphStore::query returns whatever rows
were staged via InMemoryGraphStore::stage_rows.
§Examples
use memoir_core::graph::{GraphStore, InMemoryGraphStore};
let store = InMemoryGraphStore::new();
store.ensure_graph().await?;
store.stage_rows(vec![vec![("n".to_string(), "Alice".to_string())]]);
let rows = store.query("MATCH (n) RETURN n", &Default::default()).await?;
assert_eq!(rows[0][0].1, "Alice");Implementations§
Source§impl InMemoryGraphStore
impl InMemoryGraphStore
Sourcepub fn stage_rows(&self, rows: GraphRows)
pub fn stage_rows(&self, rows: GraphRows)
Stages the rows that the next GraphStore::query call returns.
A test affordance: since there is no Cypher engine, this lets a test arrange the result a query observes. Replaces any previously staged rows.
Trait Implementations§
Source§impl Default for InMemoryGraphStore
impl Default for InMemoryGraphStore
Source§fn default() -> InMemoryGraphStore
fn default() -> InMemoryGraphStore
Returns the “default value” for a type. Read more
Source§impl GraphStore for InMemoryGraphStore
impl GraphStore for InMemoryGraphStore
Source§async fn ensure_graph(&self) -> Result<(), GraphError>
async fn ensure_graph(&self) -> Result<(), GraphError>
Ensures the configured named graph is reachable. Read more
Source§async fn query(
&self,
_cypher: &str,
_params: &HashMap<String, GraphParam>,
) -> Result<GraphRows, GraphError>
async fn query( &self, _cypher: &str, _params: &HashMap<String, GraphParam>, ) -> Result<GraphRows, GraphError>
Runs a parameterized Cypher query against the graph, returning its rows. Read more
Source§fn forget_pids(
&self,
pids: &[&str],
) -> impl Future<Output = Result<(), GraphError>> + Send
fn forget_pids( &self, pids: &[&str], ) -> impl Future<Output = Result<(), GraphError>> + Send
Removes each forgotten pid from the graph, reference-counted. Read more
Source§fn forget_scope(
&self,
scope: &Scope,
) -> impl Future<Output = Result<(), GraphError>> + Send
fn forget_scope( &self, scope: &Scope, ) -> impl Future<Output = Result<(), GraphError>> + Send
Deletes every node and edge in
scope — a whole-tenant forget. Read moreSource§fn commit_triples<EM, ER, EdgeR>(
&self,
embedder: &EM,
entities: &ER,
edges: &EdgeR,
ctx: &CommitContext,
triples: &TripleSet,
) -> impl Future<Output = Result<usize, CommitError>> + Send
fn commit_triples<EM, ER, EdgeR>( &self, embedder: &EM, entities: &ER, edges: &EdgeR, ctx: &CommitContext, triples: &TripleSet, ) -> impl Future<Output = Result<usize, CommitError>> + Send
Commits a source’s resolved triples to the graph, returning the count. Read more
Auto Trait Implementations§
impl !Freeze for InMemoryGraphStore
impl RefUnwindSafe for InMemoryGraphStore
impl Send for InMemoryGraphStore
impl Sync for InMemoryGraphStore
impl Unpin for InMemoryGraphStore
impl UnsafeUnpin for InMemoryGraphStore
impl UnwindSafe for InMemoryGraphStore
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
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> 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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().