Skip to content

Add namespace creation/deletion to graphql#2608

Open
louisch wants to merge 7 commits into
db_v4from
feature/namespace-creation-deletion
Open

Add namespace creation/deletion to graphql#2608
louisch wants to merge 7 commits into
db_v4from
feature/namespace-creation-deletion

Conversation

@louisch
Copy link
Copy Markdown
Contributor

@louisch louisch commented May 13, 2026

What changes were proposed in this pull request?

Adding (empty) namespace creation and namespace deletion (with all children) as APIs to the GraphQL APIs

Why are the changes needed?

I'd like to have the ability to delete namespaces via the raphtory API rather than using OS-level functions to delete the folders. Especially also because the cache needs to be handled correctly to avoid error messages appearing on the raphtory side.
Namespace deletion particularly feels like something that ought to exist in the API, otherwise it is possible to create namespaces via the current APIs but deleting them isn't possible (deleting the graphs is, but not their namespaces). Empty namespace creation was mostly just because it seems awkward having to use the graph creation APIs to indirectly create namespaces.

Does this PR introduce any user-facing change? If yes is this documented?

Yes, two new API functions. Both are commented.

How was this patch tested?

New tests were added testing the two new endpoints in various scenarios

Are there any further changes required?

This increases the surface of the graphql API so if any changes to RBAC happen then those will need to be applied to these two new functions too

@louisch louisch force-pushed the feature/namespace-creation-deletion branch from 1123952 to accca35 Compare May 13, 2026 14:05
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 61acc5b Previous: 9823ef7 Ratio
lotr_graph/num_edges 5 ns/iter (± 0) 0 ns/iter (± 0) +∞
lotr_graph/num_nodes 5 ns/iter (± 0) 1 ns/iter (± 0) 5
lotr_graph/has_node_nonexisting 5 ns/iter (± 0) 2 ns/iter (± 0) 2.50
lotr_graph/iterate_exploded_edges 575941 ns/iter (± 4422) 285473 ns/iter (± 2920) 2.02
lotr_graph/graph_latest 3 ns/iter (± 0) 0 ns/iter (± 0) +∞
lotr_graph_materialise/materialize 7709965 ns/iter (± 154090) 1564816 ns/iter (± 35303) 4.93
lotr_graph_window_100/num_nodes 13 ns/iter (± 0) 5 ns/iter (± 0) 2.60
lotr_graph_window_100/iterate_exploded_edges 796839 ns/iter (± 3964) 325242 ns/iter (± 847) 2.45
lotr_graph_window_100_materialise/materialize 8104392 ns/iter (± 224547) 1669150 ns/iter (± 10700) 4.86
lotr_graph_window_10/has_node_existing 145 ns/iter (± 7) 62 ns/iter (± 11) 2.34
lotr_graph_window_10/iterate nodes 32735 ns/iter (± 434) 11339 ns/iter (± 40) 2.89
lotr_graph_window_10/iterate edges 102401 ns/iter (± 267) 48684 ns/iter (± 211) 2.10
lotr_graph_window_10/iterate_exploded_edges 399068 ns/iter (± 1598) 155788 ns/iter (± 1001) 2.56
lotr_graph_window_10_materialise/materialize 3599684 ns/iter (± 52598) 971980 ns/iter (± 4278) 3.70
lotr_graph_subgraph_10pc/has_node_nonexisting 5 ns/iter (± 0) 2 ns/iter (± 0) 2.50
lotr_graph_subgraph_10pc_materialise/materialize 1694536 ns/iter (± 28278) 334634 ns/iter (± 1287) 5.06
lotr_graph_subgraph_10pc_windowed/has_node_existing 152 ns/iter (± 8) 62 ns/iter (± 14) 2.45
lotr_graph_subgraph_10pc_windowed/iterate nodes 5509 ns/iter (± 110) 1365 ns/iter (± 3) 4.04
lotr_graph_subgraph_10pc_windowed_materialise/materialize 1048609 ns/iter (± 15942) 230399 ns/iter (± 2617) 4.55
lotr_graph_window_50_layered/num_edges_temporal 150359 ns/iter (± 2518) 70121 ns/iter (± 7586) 2.14
lotr_graph_window_50_layered/has_node_existing 444 ns/iter (± 18) 129 ns/iter (± 12) 3.44
lotr_graph_window_50_layered/has_node_nonexisting 5 ns/iter (± 0) 2 ns/iter (± 0) 2.50
lotr_graph_window_50_layered/iterate nodes 75952 ns/iter (± 175) 19308 ns/iter (± 47) 3.93
lotr_graph_window_50_layered/iterate edges 196957 ns/iter (± 686) 83616 ns/iter (± 1318) 2.36
lotr_graph_window_50_layered/graph_latest 78683 ns/iter (± 2061) 36649 ns/iter (± 916) 2.15
lotr_graph_window_50_layered_materialise/materialize 33644703 ns/iter (± 709338) 3488825 ns/iter (± 24948) 9.64
lotr_graph_persistent_window_50_layered/num_edges_temporal 614151 ns/iter (± 32176) 192686 ns/iter (± 1569) 3.19
lotr_graph_persistent_window_50_layered/has_node_existing 479 ns/iter (± 311) 174 ns/iter (± 83) 2.75
lotr_graph_persistent_window_50_layered/has_node_nonexisting 5 ns/iter (± 0) 2 ns/iter (± 0) 2.50
lotr_graph_persistent_window_50_layered/iterate nodes 98049 ns/iter (± 218) 35886 ns/iter (± 191) 2.73
lotr_graph_persistent_window_50_layered/iterate edges 174096 ns/iter (± 433) 84161 ns/iter (± 596) 2.07
lotr_graph_persistent_window_50_layered/iterate_exploded_edges 4275799 ns/iter (± 73670) 1659940 ns/iter (± 19402) 2.58
lotr_graph_persistent_window_50_layered/graph_latest 116225 ns/iter (± 5702) 57549 ns/iter (± 4809) 2.02
lotr_graph_persistent_window_50_layered_materialise/materialize 58399648 ns/iter (± 2369519) 5298035 ns/iter (± 147912) 11.02
lotr_graph/proto_decode 3827493 ns/iter (± 548545) 1893824 ns/iter (± 69415) 2.02
lotr_graph/proto_encode 9597066 ns/iter (± 594554) 1157897 ns/iter (± 73709) 8.29

This comment was automatically generated by workflow using github-action-benchmark.

louisch added 2 commits May 14, 2026 16:05
Add TestSetup struct, setup_with_graphs, run_mutation, and assert_is_namespace_dir
helpers to mod graphql_test in raphtory-graphql/src/lib.rs for use by namespace tests
in later tasks.
Previously called validate_path_for_insert which created a graph-folder
skeleton + dirty marker on disk and leaked them, so the new namespace
appeared as a MetaGraph. Now uses validate_path_for_namespace_create
plus fs::create_dir_all.
test: createNamespace creates nested directories
test: createNamespace rejects path of existing graph
test: createNamespace rejects path of existing namespace
test: createNamespace rejects invalid paths
test: tighten createNamespace existing-namespace error check
test: add FakePolicy and setup_with_policy helpers
test: createNamespace denied without parent write
test: tighten FakePolicy docs and silence dead-code warning
test: deleteNamespace removes empty namespace
test: deleteNamespace removes namespace with children
test: deleteNamespace rejects empty path
test: deleteNamespace rejects non-existent path
test: deleteNamespace denied when descendant graph unwritable
test: deleteNamespace invalidates cached graphs
test: clarify deleteNamespace denied-test comments
feat(graphql): deleteNamespace infrastructure
- auth.rs: add is_exclusive_write so deleteNamespace acquires the
  exclusive write lock alongside updateGraph
- namespace.rs: expose current_dir() and relative_path() accessors used
  by Mut::delete_namespace and the data layer
@louisch louisch force-pushed the feature/namespace-creation-deletion branch from accca35 to 6f8a5bf Compare May 14, 2026 15:43
Comment thread raphtory-graphql/src/data.rs Outdated
Comment thread raphtory-graphql/src/model/graph/namespace.rs
Comment thread raphtory-graphql/src/model/mod.rs Outdated
Comment thread raphtory-graphql/src/data.rs Outdated
Comment thread raphtory-graphql/src/auth.rs Outdated
Comment thread raphtory-graphql/src/data.rs Outdated
Comment thread raphtory-graphql/src/lib.rs
@shivamka1
Copy link
Copy Markdown
Collaborator

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants