Skip to content

daemon: expose NodeServiceImpl::node_service() accessor (unblocks Pro multi-DB routing) - #1710

Merged
mstomar125 merged 1 commit into
mainfrom
worktree-core-nodeservice-accessor
Jul 21, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
worktree-core-nodeservice-accessor

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

What

Adds NodeServiceImpl::node_service(&self) -> Arc<NodeService> — a public accessor for the underlying NodeService the gRPC impl serves.

Why

Foundation for the Pro daemon multi-database routing work (nodespace-sync#327, ADR-053). When nodespaced-pro opens its default database through the DatabaseManager (so x-ns-database-id routing works and database list reports it open), cloud-sync must bind to the same NodeService the router's handlers serve. The manager's bundle (DatabaseServices) only exposed node_service_grpc: NodeServiceImpl, and its inner node_service was private — so cloud-sync couldn't reuse it and would otherwise construct a second NodeService on the same file (single-writer contention). This accessor closes that gap.

Test

Added node_service_accessor_returns_the_same_underlying_service — asserts Arc::ptr_eq between the accessor's result and the service passed to new. Pre-push gate (test:all + Rust) green.

No behavior change for existing callers; purely additive.

Adds a public accessor returning the underlying Arc<NodeService> a
NodeServiceImpl serves. Lets a caller that opens a database through the
DatabaseManager reuse the same NodeService the gRPC handlers serve — e.g. the
Pro daemon binding cloud-sync to the manager's default database instead of
constructing a second store on the same file (single-writer contention).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE — purely additive accessor: returns self.node_service.clone() (an Arc clone, no behavior change for existing callers). Test asserts Arc::ptr_eq so it genuinely hands back the same allocation — which is the whole point (Pro daemon reuses the manager's default NodeService instead of double-opening the file). Pre-push gate green. Merging.

@mstomar125
mstomar125 merged commit 8cd6a86 into main Jul 21, 2026
@mstomar125
mstomar125 deleted the worktree-core-nodeservice-accessor branch July 21, 2026 13:15
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.

1 participant