Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f928edb
Return GRAPH_META_PATH definition to graph_folder.rs and out of each …
arienandalibi May 27, 2026
4209b36
Move graph_folder constants out of raphtory and into raphtory-api.
arienandalibi May 27, 2026
9d1ddfc
Now that the pub constants are in raphtory-api, we can avoid the dupl…
arienandalibi May 27, 2026
c62e445
Fix import
arienandalibi May 28, 2026
b1e13b5
Merge branch 'db_v4' into db_v4_move_graph_folder
arienandalibi Jun 9, 2026
2cab13c
Instead of moving constants only, move the whole graph_folder.rs file…
arienandalibi Jun 12, 2026
adede86
Merge branch 'db_v4' into db_v4_move_graph_folder
fabianmurariu Jun 12, 2026
e92a0c3
Merge remote-tracking branch 'origin/db_v4_move_graph_folder' into db…
arienandalibi Jun 15, 2026
f2ce071
Revert "Instead of moving constants only, move the whole graph_folder…
arienandalibi Jun 15, 2026
8b826a9
Run rustfmt
arienandalibi Jun 15, 2026
526fbf0
Move GraphMetadata and Metadata to raphtory-api crate. Still need to …
arienandalibi Jun 15, 2026
a911f24
Update write_metadata on InnerGraphFolder to use the new write_atomic…
arienandalibi Jun 16, 2026
df18adf
Merge branch 'db_v4' into db_v4_move_graph_folder
arienandalibi Jun 16, 2026
ca3f9f8
Update Drop and flush on graphs to use InnerGraphFolder's write_metad…
arienandalibi Jun 16, 2026
abe4b65
Stop creating InnerGraphFolder, instead create Metadata and write it …
arienandalibi Jun 16, 2026
c1f616d
Merge branch 'db_v4' into db_v4_move_graph_folder
fabianmurariu Jun 19, 2026
c7554f8
Remove Drop impl on Storage. remove test for it.
arienandalibi Jun 22, 2026
e1a6339
Remove meta file update logic from AdditionOps::flush (in raphtory) t…
arienandalibi Jun 23, 2026
6f20a98
Preparing for move of GraphPaths over to raphtory-api. Add zip behind…
arienandalibi Jun 25, 2026
a25472e
Prepare rest of graph_folder.rs file for move to raphtory-api. Change…
arienandalibi Jun 26, 2026
45532a6
Move contents of graph_folder.rs in raphtory over to graph_folder.rs …
arienandalibi Jun 26, 2026
37c855c
Move tests to raphtory-tests and get rid of old graph_folder.rs file
arienandalibi Jun 26, 2026
3495740
Merge branch 'db_v4' into db_v4_move_graph_folder
arienandalibi Jun 26, 2026
f7535c2
Change tmp file to NamedTempFile to keep fix from commit f67d5617
arienandalibi Jun 26, 2026
c18fcc5
Merge branch 'db_v4' into db_v4_move_graph_folder
arienandalibi Jun 26, 2026
5998f9e
Cleanup after merge. Add SystemTimeError to GraphFolderError
arienandalibi Jun 26, 2026
66ec85e
Get rid of "io" feature in raphtory-api
arienandalibi Jun 29, 2026
a1f487a
Merge branch 'db_v4' into db_v4_move_graph_folder
fabianmurariu Jul 1, 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 Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion db4-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rust-version.workspace = true
edition = "2024"

[dependencies]
raphtory-api.workspace = true
raphtory-api.workspace = true
raphtory-api-macros.workspace = true
raphtory-core = { workspace = true }
raphtory-itertools.workspace = true
Expand Down
12 changes: 0 additions & 12 deletions db4-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,3 @@ pub fn read_constant_graph_properties(
> {
Ok(Vec::new())
}

/// Matches `db4_disk_storage::meta_file::GRAPH_META_PATH`
pub const GRAPH_META_PATH: &str = ".meta";

/// No-op shim for when we have db4-storage instead of db4-disk-storage
pub fn refresh_disk_graph_metadata(
_disk_graph_path: &Path,
_node_count: usize,
_edge_count: usize,
) -> Result<(), error::StorageError> {
Ok(())
}
57 changes: 56 additions & 1 deletion db4-storage/src/pages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ use graph_prop_store::GraphPropStorageInner;
use node_page::writer::NodeWriter;
use node_store::NodeStorageInner;
use parking_lot::RwLockWriteGuard;
use raphtory_api::core::entities::properties::meta::Meta;
use raphtory_api::core::{
entities::properties::meta::Meta,
storage::graph_folder::{GRAPH_META_PATH, GraphMetadata, Metadata},
};
use rayon::prelude::*;
use std::{
fs::File,
io::ErrorKind,
path::{Path, PathBuf},
sync::{
Arc,
Expand Down Expand Up @@ -77,6 +82,56 @@ impl<
self.nodes.flush()?;
self.edges.flush()?;
self.graph_props.flush()?;

self.refresh_metadata()?;

Ok(())
}

/// Refresh the graph metadata file (`.meta`) for disk-backed graphs. Reads graph type from the existing meta file.
/// Errors if the file can't be read or the graph path has changed
fn refresh_metadata(&self) -> Result<(), StorageError> {
let Some(graph_dir) = self.graph_dir.as_ref() else {
return Ok(());
};
let (Some(data_folder), Some(graph_path)) = (
graph_dir.parent(),
graph_dir.file_name().and_then(|name| name.to_str()),
) else {
return Ok(());
};

// if the file doesn't exist, there is nothing to refresh
let meta_path = data_folder.join(GRAPH_META_PATH);
let file = match File::open(&meta_path) {
Ok(file) => file,
Err(err) if err.kind() == ErrorKind::NotFound => return Ok(()),
Err(err) => return Err(err.into()),
};

// a corrupted file returns an error
let existing: Metadata = serde_json::from_reader(file)?;

// the graph data directory must not change between writes
if existing.path != graph_path {
return Err(StorageError::GenericFailure(format!(
"graph path in {} changed from {:?} to {:?}",
meta_path.display(),
existing.path,
graph_path,
)));
}

let metadata = Metadata {
path: graph_path.to_string(),
meta: GraphMetadata {
node_count: self.nodes.num_nodes(),
edge_count: self.edges.num_edges(),
graph_type: existing.meta.graph_type,
is_diskgraph: true,
},
};
metadata.write_atomic(data_folder, &meta_path)?;
Ok(())
}
}
Expand Down
6 changes: 4 additions & 2 deletions raphtory-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ edition.workspace = true

[dependencies]
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, optional = true }
serde_json = { workspace = true }
zip = { workspace = true }
walkdir = { workspace = true }
tempfile = { workspace = true }
bigdecimal = { workspace = true, features = ["string-only"] }
thiserror = { workspace = true }
bytemuck = { workspace = true }
Expand Down Expand Up @@ -59,4 +62,3 @@ python = [
vectors = []
template = ["dep:minijinja"]
search = []
io = ["dep:serde_json"]
1 change: 0 additions & 1 deletion raphtory-api/src/core/entities/properties/prop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ mod prop_enum;
mod prop_ref_enum;
mod prop_type;
mod prop_unwrap;
#[cfg(feature = "io")]
mod serde;

#[cfg(feature = "template")]
Expand Down
Loading
Loading