Skip to content

Introduce session#263

Merged
knutwalker merged 20 commits into
mainfrom
introduce-session
Sep 15, 2025
Merged

Introduce session#263
knutwalker merged 20 commits into
mainfrom
introduce-session

Conversation

@madchicken

@madchicken madchicken commented Sep 11, 2025

Copy link
Copy Markdown
Collaborator

This PR introduces the concept of sessions when enabling the feature flag unstable-bolt-protocol-impl-v2.

The driver now provides a with_session method, allowing a session to be created on an existing connection. Sessions can be used to specify the target database, impersonate a user, and set the fetch size for queries. Bookmark handling has also been corrected to work properly within sessions.

Additionally, this PR updates the routing logic, as support for user impersonation required changes in that area.

Unfortunately, the changes are many and the PR is quite big.

Routing Refactor

Due to a deadlock caused by the use of DashMaps in the connection registry, this PR includes a complete refactor of the routing protocol. The router is now lazy and no longer relies on a separate task to fetch routing tables. This simplifies the design and improves code readability.

Graph Structure API

The PR changes the Graph structure API: the method execute_on is now forcing the user to pass the operation to perform (read or write) in order to pick the right server from the routing table.

@madchicken madchicken self-assigned this Sep 11, 2025
@madchicken madchicken force-pushed the introduce-session branch 3 times, most recently from 9e42dbd to fe8a52a Compare September 12, 2025 13:12

@knutwalker knutwalker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this PR, well done! I have some minor things around avoid allocations/clones here and there, but I would like to have at least the readme being fixed before merging

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread lib/src/session.rs Outdated
Comment thread lib/src/routing/connection_registry.rs Outdated
Comment thread lib/src/routing/connection_registry.rs Outdated
Comment thread lib/src/routing/connection_registry.rs Outdated
Comment thread lib/src/routing/connection_registry.rs Outdated
Comment thread lib/src/routing/connection_registry.rs Outdated
@knutwalker

Copy link
Copy Markdown
Contributor

Also a note on the MSRV, there are multiple dependencies that already have a higher MSRV than 1.75. We do downgrade/pin those dependencies when generating the lockfiles for CI (

neo4rs/xtask/src/main.rs

Lines 68 to 73 in 2b571c4

("idna_adapter".to_owned(), "1.2.0"),
("litemap".to_owned(), "0.7.4"),
("home".to_owned(), "0.5.9"),
("testcontainers".to_owned(), "0.23.1"),
("testcontainers-modules".to_owned(), "0.11.4"),
("zerofrom".to_owned(), "0.1.5"),
and

neo4rs/xtask/src/main.rs

Lines 100 to 106 in 2b571c4

("idna_adapter".to_owned(), "1.2.0"),
("litemap".to_owned(), "0.7.4"),
("home".to_owned(), "0.5.9"),
("serde_repr".to_owned(), "0.1.5"),
("testcontainers".to_owned(), "0.23.1"),
("testcontainers-modules".to_owned(), "0.11.4"),
("zerofrom".to_owned(), "0.1.5"),
-- those two lists might even be different at times). It also means that a user can't just add neo4rs on the MSRV version without also having to downgrade on their end (which they would have to do anyway).
We still have the latest (or reasonably latest) versions in the dependencies, so that you don't have to use older versions and recent rust versions.

I have a preference to "pin" time to 0.3.41 in the xtask script over raising the MSRV.

@knutwalker

Copy link
Copy Markdown
Contributor

actually, I did the changes in #265 -- you should be able to keep 1.75 after rebasing

@knutwalker knutwalker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 thanks!

@knutwalker knutwalker merged commit 93161a8 into main Sep 15, 2025
11 checks passed
@knutwalker knutwalker deleted the introduce-session branch September 15, 2025 16:18
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