Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bf10be6
Current iteration. Persisted Vec<bool>, where entry i corresponds to …
arienandalibi May 29, 2026
934cd2b
Changed graphql schema generation to use the bitsets (Vec<bool> for n…
arienandalibi Jun 2, 2026
d71d96d
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jun 3, 2026
f20fc4f
Cleanup and add FIXME comments
arienandalibi Jun 3, 2026
3a36d30
More cleanup
arienandalibi Jun 3, 2026
197d0d6
Add comments on types for clarity
arienandalibi Jun 5, 2026
39564e7
Added property presence bitset (Vec<bool>) in PropMapper. We have one…
arienandalibi Jun 9, 2026
5ea955f
Added optimizations to skip layers when we know the property isn't fo…
arienandalibi Jun 9, 2026
bf4fe7b
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jun 9, 2026
b00185a
Get rid of all bitsets Vec<bool> added on LayerStatStore and Properti…
arienandalibi Jun 10, 2026
27622be
Get rid of the extra logic we added in the schemas to try and use the…
arienandalibi Jun 10, 2026
075b924
Get rid of previously added LayerPropSchema and it's uses
arienandalibi Jun 10, 2026
0cf39d9
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jun 12, 2026
14eba92
run rustfmt
arienandalibi Jun 12, 2026
ba4aaff
Change LayerSchema to scan edges once and bucket them by (src_node_ty…
arienandalibi Jun 15, 2026
6884496
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jun 16, 2026
0da92e9
Cleanup after merge
arienandalibi Jun 16, 2026
733194b
Update schema collection on edge properties/metadata to avoid scannin…
arienandalibi Jun 16, 2026
5d659aa
Added a SchemaCache to allow caching of generated EdgeSchemas propert…
arienandalibi Jun 18, 2026
0b2c9cc
Changed schema cache lookup key to be a struct instead of a (String, …
arienandalibi Jun 19, 2026
5abe811
Added a node schema cache
arienandalibi Jun 22, 2026
2e836e8
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jun 22, 2026
14c89da
Get rid of Arc on Vec<PropertySchema> in the cache.
arienandalibi Jun 22, 2026
cf6bb9a
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jun 23, 2026
48c243b
Clean up comments
arienandalibi Jun 23, 2026
0b08c8d
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jun 29, 2026
c69df94
Get rid of EdgeSchema. Instead, we use LayerSchema to report properti…
arienandalibi Jun 30, 2026
5a5a314
Re-introduce the cache that was for EdgeSchema (now LayerSchema). Get…
arienandalibi Jun 30, 2026
bb5c4dc
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jun 30, 2026
ee63177
regenerate schema.graphql
arienandalibi Jul 2, 2026
ad946b4
Cleanup
arienandalibi Jul 6, 2026
53e2dea
Add 2 tests for the property presence bitsets filtering
arienandalibi Jul 6, 2026
66ac036
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jul 7, 2026
3097a79
Fixed failing tests. Moved the tests for round trip persistence of th…
arienandalibi Jul 7, 2026
a7db749
chore: apply tidy-public auto-fixes
github-actions[bot] Jul 7, 2026
3df6924
Change logic to get layer ids from the graph. We use unique_layers now.
arienandalibi Jul 8, 2026
aee77a1
Merge branch 'db_v4' into db_v4_schema_layer
arienandalibi Jul 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions db4-storage/src/api/edges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,7 @@ pub trait EdgeRefOps<'a>: Copy + Clone + Send + Sync {

fn edge_id(&self) -> EID;
fn edge_ref(self, dir: Dir) -> Option<EdgeRef>;

/// Graph-wide edge `Meta`
fn edge_meta(&self) -> &Arc<Meta>;
}
25 changes: 25 additions & 0 deletions db4-storage/src/pages/edge_page/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ impl<'a, MP: DerefMut<Target = MemEdgeSegment> + std::fmt::Debug, ES: EdgeSegmen
layer_id: LayerId,
) -> LocalPOS {
self.graph_stats.update_time(t.t());
// Update the per-layer property presence bitset in Meta.
// `.inspect` runs once per emitted item as the iterator is consumed in `insert_edge_internal`
let meta = self.writer.edge_meta().clone();
let props = props.into_iter().inspect(move |(id, _)| {
meta.temporal_prop_mapper()
.mark_prop_in_layer(layer_id, *id);
});
if self
.writer
.insert_edge_internal(t, edge_pos, src, dst, layer_id, props)
Expand Down Expand Up @@ -132,6 +139,15 @@ impl<'a, MP: DerefMut<Target = MemEdgeSegment> + std::fmt::Debug, ES: EdgeSegmen
}
}

// Update the per-layer property presence bitset in Meta.
// `.inspect` runs once per emitted item as the iterator is consumed in `insert_edge_internal`
let meta = self.writer.edge_meta().clone();
let t_meta = meta.as_ref();
let t_props = t_props.into_iter().inspect(move |(id, _)| {
t_meta
.temporal_prop_mapper()
.mark_prop_in_layer(layer_id, *id);
});
if self
.writer
.insert_edge_internal(t, edge_pos, src, dst, layer_id, t_props)
Expand All @@ -142,6 +158,9 @@ impl<'a, MP: DerefMut<Target = MemEdgeSegment> + std::fmt::Debug, ES: EdgeSegmen

self.graph_stats.update_time(t.t());

let c_props = c_props.into_iter().inspect(move |(id, _)| {
meta.metadata_mapper().mark_prop_in_layer(layer_id, *id);
});
self.writer
.update_const_properties(edge_pos, src, dst, layer_id, c_props);
}
Expand Down Expand Up @@ -213,6 +232,12 @@ impl<'a, MP: DerefMut<Target = MemEdgeSegment> + std::fmt::Debug, ES: EdgeSegmen
if !existing_edge {
self.increment_layer_num_edges(layer_id);
}
// Update the per-layer property presence bitset in Meta.
// `.inspect` runs once per emitted item as the iterator is consumed in `update_const_properties`
let meta = self.writer.edge_meta().clone();
let props = props.into_iter().inspect(move |(id, _)| {
meta.metadata_mapper().mark_prop_in_layer(layer_id, *id);
});
self.writer
.update_const_properties(edge_pos, src, dst, layer_id, props);
}
Expand Down
13 changes: 13 additions & 0 deletions db4-storage/src/pages/node_page/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ impl<'a, MP: DerefMut<Target = MemNodeSegment> + 'a, NS: NodeSegmentOps> NodeWri
props: impl IntoIterator<Item = (usize, P)>,
) {
self.l_counter.update_time(t.t());
// Update the per-layer property presence bitset in Meta.
// `.inspect` runs once per emitted item as the iterator is consumed in `add_props`
let meta = self.mut_segment.node_meta().clone();
let props = props.into_iter().inspect(move |(id, _)| {
meta.temporal_prop_mapper()
.mark_prop_in_layer(layer_id, *id);
});
let (is_new_node, add) = self.mut_segment.add_props(t, pos, layer_id, props);
self.mut_segment.increment_est_size(add);
if is_new_node && !self.page.has_node(pos, layer_id) {
Expand All @@ -178,6 +185,12 @@ impl<'a, MP: DerefMut<Target = MemNodeSegment> + 'a, NS: NodeSegmentOps> NodeWri
layer_id: LayerId,
props: impl IntoIterator<Item = (usize, P)>,
) {
// Update the per-layer property presence bitset in Meta.
// `.inspect` runs once per emitted item as the iterator is consumed in `update_metadata`
let meta = self.mut_segment.node_meta().clone();
let props = props.into_iter().inspect(move |(id, _)| {
meta.metadata_mapper().mark_prop_in_layer(layer_id, *id);
});
let (is_new_node, add) = self.mut_segment.update_metadata(pos, layer_id, props);
self.mut_segment.increment_est_size(add);
if is_new_node && !self.page.has_node(pos, layer_id) {
Expand Down
4 changes: 4 additions & 0 deletions db4-storage/src/pages/node_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ pub struct ReadLockedNodeStorage<NS: NodeSegmentOps<Extension = EXT>, EXT> {
impl<NS: NodeSegmentOps<Extension = EXT>, EXT: PersistenceStrategy<NS = NS>>
ReadLockedNodeStorage<NS, EXT>
{
pub fn storage(&self) -> &NodeStorageInner<NS, EXT> {
&self.storage
}

pub fn node_ref(
&self,
node: impl Into<VID>,
Expand Down
1 change: 1 addition & 0 deletions db4-storage/src/properties/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use std::sync::Arc;

pub mod props_meta_writer;

/// Contains the properties of a `SegmentContainer` (which corresponds to one layer in a Mem(Edge/Node)Segment)
#[derive(Debug, Default)]
pub struct Properties {
c_properties: Vec<PropColumn>,
Expand Down
13 changes: 11 additions & 2 deletions db4-storage/src/segments/edge/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ use crate::{
generic_time_ops::{AdditionCellsRef, DeletionCellsRef, WithTimeCells},
segments::{additions::MemAdditions, edge::segment::MemEdgeSegment},
};
use raphtory_api::core::entities::{LayerId, edges::edge_ref::Dir, properties::prop::Prop};
use raphtory_api::core::entities::{
LayerId,
edges::edge_ref::Dir,
properties::{meta::Meta, prop::Prop},
};
use raphtory_core::{
entities::{
EID, Multiple, VID,
Expand All @@ -14,7 +18,7 @@ use raphtory_core::{
},
storage::timeindex::{EventTime, TimeIndexOps},
};
use std::marker::PhantomData;
use std::{marker::PhantomData, sync::Arc};

#[derive(Debug)]
pub struct MemEdgeEntry<'a, MES> {
Expand Down Expand Up @@ -227,4 +231,9 @@ impl<'a> EdgeRefOps<'a> for MemEdgeRef<'a> {
fn internal_num_layers(self) -> usize {
self.es.as_ref().len()
}

#[inline]
fn edge_meta(&self) -> &Arc<Meta> {
self.es.edge_meta()
}
}
1 change: 1 addition & 0 deletions db4-storage/src/segments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ impl<T: HasRow> SparseVec<T> {
}
}

/// A single layer's data in a Mem(Edge/Node)Segment.
#[derive(Debug)]
pub struct SegmentContainer<T> {
segment_id: usize,
Expand Down
74 changes: 14 additions & 60 deletions docs/reference/graphql/graphql_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1505,61 +1505,6 @@ Composite edge filter (by property, layer, src/dst, etc.).
</tbody>
</table>

### EdgeSchema

Describes edges between a specific pair of node types — the property and
metadata keys seen on such edges, along with their observed value types.
One `EdgeSchema` per `(srcType, dstType)` pair per layer.

<table>
<thead>
<tr>
<th align="left">Field</th>
<th align="right">Argument</th>
<th align="left">Type</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" valign="top"><strong id="edgeschema.srctype">srcType</strong></td>
<td valign="top"><a href="#string">String</a>!</td>
<td>

Returns the type of source for these edges

</td>
</tr>
<tr>
<td colspan="2" valign="top"><strong id="edgeschema.dsttype">dstType</strong></td>
<td valign="top"><a href="#string">String</a>!</td>
<td>

Returns the type of destination for these edges

</td>
</tr>
<tr>
<td colspan="2" valign="top"><strong id="edgeschema.properties">properties</strong></td>
<td valign="top">[<a href="#propertyschema">PropertySchema</a>!]!</td>
<td>

Returns the list of property schemas for edges connecting these types of nodes

</td>
</tr>
<tr>
<td colspan="2" valign="top"><strong id="edgeschema.metadata">metadata</strong></td>
<td valign="top">[<a href="#propertyschema">PropertySchema</a>!]!</td>
<td>

Returns the list of metadata schemas for edges connecting these types of nodes

</td>
</tr>
</tbody>
</table>

### EdgeWindowSet

A lazy sequence of per-window views of a single edge, produced by
Expand Down Expand Up @@ -4297,8 +4242,8 @@ Compute the minimum interval between consecutive timestamps. Returns None if few

### LayerSchema

Describes a single edge layerits name and the per `(srcType, dstType)`
edge schemas observed within it.
Describes a single edge layer: its name and the edge property/metadata keys
present in it, with observed variants (property values) on small graphs

<table>
<thead>
Expand All @@ -4320,11 +4265,20 @@ Returns the name of the layer with this schema
</td>
</tr>
<tr>
<td colspan="2" valign="top"><strong id="layerschema.edges">edges</strong></td>
<td valign="top">[<a href="#edgeschema">EdgeSchema</a>!]!</td>
<td colspan="2" valign="top"><strong id="layerschema.properties">properties</strong></td>
<td valign="top">[<a href="#propertyschema">PropertySchema</a>!]!</td>
<td>

Returns the list of property schemas present on edges in this layer

</td>
</tr>
<tr>
<td colspan="2" valign="top"><strong id="layerschema.metadata">metadata</strong></td>
<td valign="top">[<a href="#propertyschema">PropertySchema</a>!]!</td>
<td>

Returns the list of edge schemas for this edge layer
Returns the list of metadata schemas present on edges in this layer

</td>
</tr>
Expand Down
Loading
Loading