Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7a43d50
cache wip
ljeub-pometry May 13, 2026
cb4b78b
attempt to make this work with dashmap but it is getting complicated
ljeub-pometry May 12, 2026
938721d
implement dirty graph handling using pinning only
ljeub-pometry May 13, 2026
2d8a856
fix python
ljeub-pometry May 13, 2026
d306bf0
remove test of tti-based eviction as it is no longer a thing
ljeub-pometry May 13, 2026
647cffe
chore: apply tidy-public auto-fixes
github-actions[bot] May 13, 2026
6fba487
Merge db_v4 into gql_cache
ljeub-pometry May 13, 2026
3ce4ad8
make the server startup work with port=0 and add fallback when the se…
ljeub-pometry May 14, 2026
d7d1aa2
some cleanup
ljeub-pometry May 14, 2026
a6d019f
add function to look up port on server
ljeub-pometry May 14, 2026
2074443
make the cli port behaviour consistent
ljeub-pometry May 14, 2026
f55cca4
enable panic on drop errors for tests
ljeub-pometry May 14, 2026
2012d86
make sure graph is dropped before replacing it
ljeub-pometry May 14, 2026
25784ed
update tests more tests so they work with arbitrary ports
ljeub-pometry May 14, 2026
172b89a
make the python tests work even if there is a raphtory server running
ljeub-pometry May 14, 2026
ab0773b
Need to actually use the newly materialized graph and not the old gra…
ljeub-pometry May 18, 2026
97258ec
moving a graph to the same name should be a no-op, not delete the graph
ljeub-pometry May 18, 2026
1f0392c
remove dbg
ljeub-pometry May 18, 2026
9b1f470
make sure the timeout test isn't flaky if the server happens to start…
ljeub-pometry May 18, 2026
0a4b232
chore: apply tidy-public auto-fixes
github-actions[bot] May 18, 2026
cd5eddf
delete empty tests file
ljeub-pometry May 19, 2026
176ab37
make sure we don't return the unfiltered graph when only filtered acc…
ljeub-pometry May 19, 2026
2bba278
get list of nodes and edges by querying the graph on the server to av…
ljeub-pometry May 19, 2026
d45e984
explicitly control the drop order in test to make sure graph and data…
ljeub-pometry May 19, 2026
a97712a
fix drop order problem in tests that would cause the directory to be …
ljeub-pometry May 19, 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
24 changes: 20 additions & 4 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ raphtory-storage = { version = "0.18.0", path = "raphtory-storage", default-feat
raphtory-itertools = { version = "0.18.0", path = "raphtory-itertools" }
clam-core = { version = "0.18.0", path = "clam-core" }
optd-core = { version = "0.18.0", path = "optd/optd/core" }

async-graphql = { version = "7.2.1", features = ["dynamic-schema"] }
bincode = { version = "2", features = ["serde"] }
async-graphql-poem = "7.2.1"
dynamic-graphql = { git = "https://github.com/miratepuffin/dynamic-graphql", branch = "add-arg-descriptions" }
dynamic-graphql = "0.10.2"
derive_more = "2.1.1"
tikv-jemallocator = "0.6.1"
reqwest = { version = "0.12.28", default-features = false, features = [
Expand Down Expand Up @@ -167,7 +168,6 @@ pest = "2.8.6"
pest_derive = "2.8.6"
minijinja = "2.18.0"
minijinja-contrib = { version = "2.18.0", features = ["datetime"] }

lancedb = { version = "0.27.2", features = [] }
heed = "0.22.0"
sqlparser = "0.59.0"
Expand All @@ -185,6 +185,7 @@ arrow-data = { version = "57.3.0" }
arrow-select = { version = "57.3.0" }
serde_arrow = { version = "0.13.7", features = ["arrow-57"] }
moka = { version = "0.12.15", features = ["future"] }
quick_cache = "0.6.21"
indexmap = { version = "2.13.0", features = ["rayon"] }
fake = { version = "3.1.0", features = ["chrono"] }
strsim = { version = "0.11.1" }
Expand Down
5 changes: 3 additions & 2 deletions db4-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ rayon.workspace = true
test-log.workspace = true

[features]
test-utils = ["dep:proptest", "dep:chrono"]
default = ["test-utils"]
test-utils = ["dep:proptest", "dep:chrono", "panic-on-drop"]
panic-on-drop = []

12 changes: 4 additions & 8 deletions db4-storage/src/pages/graph_prop_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::{
};
use raphtory_api::core::entities::properties::meta::Meta;
use std::{
marker::PhantomData,
path::{Path, PathBuf},
sync::Arc,
};
Expand All @@ -23,10 +24,7 @@ pub struct GraphPropStorageInner<GS, EXT> {

/// Stores graph prop metadata (prop name -> prop id mappings).
meta: Arc<Meta>,

path: Option<PathBuf>,

ext: EXT,
_ext: PhantomData<EXT>,
}

impl<GS: GraphPropSegmentOps<Extension = EXT>, EXT: PersistenceStrategy>
Expand All @@ -37,9 +35,8 @@ impl<GS: GraphPropSegmentOps<Extension = EXT>, EXT: PersistenceStrategy>

Self {
page,
path: path.map(|p| p.to_path_buf()),
meta,
ext,
_ext: PhantomData,
}
}

Expand All @@ -52,9 +49,8 @@ impl<GS: GraphPropSegmentOps<Extension = EXT>, EXT: PersistenceStrategy>
path.as_ref(),
ext.clone(),
)?),
path: Some(path.as_ref().to_path_buf()),
meta: graph_props_meta,
ext,
_ext: PhantomData,
})
}

Expand Down
29 changes: 24 additions & 5 deletions db4-storage/src/pages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,21 @@ pub mod session;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;

// graph // (node/edges) // segment // layer_ids (0, 1, 2, ...) // actual graphy bits
#[cfg(any(test, feature = "panic-on-drop"))]
macro_rules! drop_error {
($($arg:tt)*) => {{
panic!($($arg)*)
}};
}

#[cfg(not(any(test, feature = "panic-on-drop")))]
macro_rules! drop_error {
($($arg:tt)*) => {{
eprintln!($($arg)*)
}};
}

// graph // (node/edges) // segment // layer_ids (0, 1, 2, ...) // actual graphy bits
#[derive(Debug)]
pub struct GraphStore<
NS: NodeSegmentOps<Extension = EXT>,
Expand Down Expand Up @@ -372,7 +385,7 @@ impl<
let checkpoint_lsn = match wal.log_shutdown_checkpoint() {
Ok(lsn) => lsn,
Err(err) => {
eprintln!("Failed to log shutdown checkpoint in drop: {err}");
drop_error!("Failed to log shutdown checkpoint in drop: {err}");
return;
}
};
Expand All @@ -381,7 +394,7 @@ impl<
let flush_lsn = wal.position();

if let Err(err) = wal.flush(flush_lsn) {
eprintln!("Failed to flush checkpoint record in drop: {err}");
drop_error!("Failed to flush checkpoint record in drop: {err}");
return;
}

Expand All @@ -390,12 +403,12 @@ impl<
control_file.set_db_state(DBState::Shutdown);

if let Err(err) = control_file.save() {
eprintln!("Failed to save control file in drop: {err}");
drop_error!("Failed to save control file in drop: {err}");
return;
}
}
Err(err) => {
eprintln!("Failed to flush storage in drop: {err}")
drop_error!("Failed to flush storage in drop: {err}");
}
}
}
Expand Down Expand Up @@ -458,4 +471,10 @@ mod test {

assert_eq!(actual, expected);
}

#[test]
#[should_panic]
fn test_drop_error() {
drop_error!("failed");
}
}
27 changes: 19 additions & 8 deletions docs/user-guide/graphql/2_run-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ Before reading this topic, please ensure you are familiar with:

## Saving your Raphtory graph into a directory

You will need some test data to complete the following examples. This can be your own data or one of the examples in the Raphtory documentation.
You will need some test data to complete the following examples. This can be your own data or one of the examples in the
Raphtory documentation.

Once your data is loaded into a Raphtory graph, the graph needs to be saved into your working directory. This can be done with the following code, where `g` is your graph:
Once your data is loaded into a Raphtory graph, the graph needs to be saved into your working directory. This can be
done with the following code, where `g` is your graph:

/// tab | :fontawesome-brands-python: Python

```{.python notest}
import os
working_dir = "graphs/"
Expand All @@ -21,6 +24,7 @@ if not os.path.exists(working_dir):
os.makedirs(working_dir)
g.save_to_file(working_dir + "your_graph")
```

///

## Starting a server
Expand All @@ -39,24 +43,31 @@ This option is the simplist and provides the most configuration options.

### Start a server in Python

If you have a [`GraphServer`][raphtory.graphql.GraphServer] object you can use either the [`.run()`][raphtory.graphql.GraphServer.run] or [`.start()`][raphtory.graphql.GraphServer.start] functions to start a GraphQL sever and Raphtory UI.
If you have a [`GraphServer`][raphtory.graphql.GraphServer] object you can use either the [
`.run()`][raphtory.graphql.GraphServer.run] or [`.start()`][raphtory.graphql.GraphServer.start] functions to start a
GraphQL sever and Raphtory UI.

Below is an example of how to start the server and send a Raphtory graph to the server, where `new_graph` is your Raphtory graph object.
Below is an example of how to start the server and send a Raphtory graph to the server, where `new_graph` is your
Raphtory graph object.

/// tab | :fontawesome-brands-python: Python

```{.python notest}
tmp_work_dir = tempfile.mkdtemp()
with GraphServer(tmp_work_dir, tracing=True).start():
client = RaphtoryClient("http://localhost:1736")
with GraphServer(tmp_work_dir, tracing=True).start() as server:
client = server.get_client()
client.send_graph(path="g", graph=new_graph)

query = """{graph(path: "g") {nodes {list {name}}}}"""
client.query(query)
```

///

You can set the port in `RaphtoryClient()` to the port the GraphQL server should run on.

The `path` parameter is always the graph in your server that you would like to read or update. So in this example, we want to send `new_graph` to graph `g` on the server to update it.
The `path` parameter is always the graph in your server that you would like to read or update. So in this example, we
want to send `new_graph` to graph `g` on the server to update it.

The `graph` parameter is set to the Raphtory graph that you would like to send. An additional `overwrite` parameter can be stated if we want this new graph to overwrite the old graph.
The `graph` parameter is set to the Raphtory graph that you would like to send. An additional `overwrite` parameter can
be stated if we want this new graph to overwrite the old graph.
Loading
Loading