pub struct StorageReaderAdapter<'a>(pub &'a dyn StorageEngine);Expand description
Adapter that lets a &dyn StorageEngine act as a GraphReader.
Needed because trait objects of unrelated traits don’t coerce —
see the note on the blanket impl<T: StorageEngine> GraphReader for T.
Wraps a trait-object reference; no heap allocation. Works for both
reads and writes via the sibling crate::writer::StorageWriterAdapter.
Tuple Fields§
§0: &'a dyn StorageEngineTrait Implementations§
Source§impl GraphReader for StorageReaderAdapter<'_>
impl GraphReader for StorageReaderAdapter<'_>
fn get_node(&self, id: NodeId) -> Result<Option<Node>>
fn get_edge(&self, id: EdgeId) -> Result<Option<Edge>>
fn all_node_ids(&self) -> Result<Vec<NodeId>>
fn nodes_by_label(&self, label: &str) -> Result<Vec<NodeId>>
Source§fn nodes_by_property(
&self,
label: &str,
property: &str,
value: &Property,
) -> Result<Vec<NodeId>>
fn nodes_by_property( &self, label: &str, property: &str, value: &Property, ) -> Result<Vec<NodeId>>
Equality lookup via a property index. Callers (planner) must
have verified the
(label, property) index exists before
emitting this call — fallback implementations are free to do a
label-scan-and-filter for impls that don’t maintain their own
property index, but the storage-backed reader treats a call on
a non-existent index as an empty result since no entries are
maintained.Source§fn edges_by_property(
&self,
edge_type: &str,
property: &str,
value: &Property,
) -> Result<Vec<EdgeId>>
fn edges_by_property( &self, edge_type: &str, property: &str, value: &Property, ) -> Result<Vec<EdgeId>>
Relationship-scope analogue of
Self::nodes_by_property.
The planner only emits an EdgeSeek after confirming a
(edge_type, property) index is registered via
Self::list_edge_property_indexes. Default impl returns
empty so readers that haven’t wired a native seek path
degrade to no-results rather than mis-answering; the
storage-backed blanket overrides with a real lookup.Source§fn list_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>>
fn list_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>>
Snapshot the
(label, property) pairs of every property
index visible through this reader. Used by SHOW INDEXES.
Default impl returns empty — the storage-backed reader
overrides via the blanket impl, and partitioned/overlay
readers delegate to their bases.Source§fn list_edge_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>>
fn list_edge_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>>
Relationship-scope analogue of
Self::list_property_indexes.
Returns (edge_type, property) pairs for every registered
edge property index. Default impl returns empty; overlay
and partitioned readers delegate to their bases.Source§fn list_point_indexes(&self) -> Result<Vec<(String, String)>>
fn list_point_indexes(&self) -> Result<Vec<(String, String)>>
Snapshot the
(label, property) pairs of every point /
spatial index visible through this reader. Used by SHOW POINT INDEXES. Default impl returns empty; storage-backed
readers override via the blanket impl.Source§fn list_edge_point_indexes(&self) -> Result<Vec<(String, String)>>
fn list_edge_point_indexes(&self) -> Result<Vec<(String, String)>>
Relationship-scope analogue of
Self::list_point_indexes.
(edge_type, property) pairs. Default impl returns empty.Source§fn nodes_in_bbox(
&self,
label: &str,
property: &str,
srid: i32,
xlo: f64,
ylo: f64,
xhi: f64,
yhi: f64,
) -> Result<Vec<NodeId>>
fn nodes_in_bbox( &self, label: &str, property: &str, srid: i32, xlo: f64, ylo: f64, xhi: f64, yhi: f64, ) -> Result<Vec<NodeId>>
Axis-aligned bounding-box range query over the point index
(label, property). Returns every node carrying label
whose property is a Property::Point under srid that
falls inside [xlo..xhi] × [ylo..yhi]. Read moreSource§fn edges_in_bbox(
&self,
edge_type: &str,
property: &str,
srid: i32,
xlo: f64,
ylo: f64,
xhi: f64,
yhi: f64,
) -> Result<Vec<EdgeId>>
fn edges_in_bbox( &self, edge_type: &str, property: &str, srid: i32, xlo: f64, ylo: f64, xhi: f64, yhi: f64, ) -> Result<Vec<EdgeId>>
Relationship-scope analogue of
Self::nodes_in_bbox.
Default impl returns empty — edge-scoped bbox queries aren’t
yet part of the planner’s rewrite surface, so no read path
exercises this on anything but the storage-backed blanket.
When the edge point-seek lowering lands this default should
grow a naive scan via edges_by_type (needs to be added to
the trait first).Source§fn list_property_constraints(&self) -> Result<Vec<PropertyConstraintSpec>>
fn list_property_constraints(&self) -> Result<Vec<PropertyConstraintSpec>>
Snapshot every registered constraint visible through this
reader, for
SHOW CONSTRAINTS and db.constraints(). Default
impl returns empty; storage-backed readers override.fn outgoing(&self, id: NodeId) -> Result<Vec<(EdgeId, NodeId)>>
fn incoming(&self, id: NodeId) -> Result<Vec<(EdgeId, NodeId)>>
Source§fn nodes_by_properties(
&self,
label: &str,
properties: &[String],
values: &[Property],
) -> Result<Vec<NodeId>>
fn nodes_by_properties( &self, label: &str, properties: &[String], values: &[Property], ) -> Result<Vec<NodeId>>
Composite form of
Self::nodes_by_property. properties
and values are parallel slices of equal length — every
slot must be present for the call to land a match. The
default impl delegates to nodes_by_property for length-1
slices and returns empty otherwise, so readers that haven’t
wired a native composite seek degrade to no-results rather
than mis-answering. The storage-backed blanket overrides
with a real composite lookup.Auto Trait Implementations§
impl<'a> Freeze for StorageReaderAdapter<'a>
impl<'a> !RefUnwindSafe for StorageReaderAdapter<'a>
impl<'a> Send for StorageReaderAdapter<'a>
impl<'a> Sync for StorageReaderAdapter<'a>
impl<'a> Unpin for StorageReaderAdapter<'a>
impl<'a> UnsafeUnpin for StorageReaderAdapter<'a>
impl<'a> !UnwindSafe for StorageReaderAdapter<'a>
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