Repository navigation
refactor: share one connection router across a manager's parts - #9597
Merged
Merged
Conversation
SyftboxManager.from_config builds the peer store and one ConnectionRouter, and passes the router to each part's from_config next to its plain config. Configs keep plain values only; connection_configs moves to SyftboxManagerConfig, where for_colab already passed it but pydantic dropped it.
koenvanderveen
added a commit
that referenced
this pull request
Oct 30, 2026
Resolve the overlap with the transport PRs on dev (#9594, #9595, #9597, #9599): - The manager builds the transport at init, as on dev. as_transport, the router's connection list and transport_for_thread are gone. - Each Drive component holds the DriveLayout and its own Drive code, as on this branch. - Each component copies itself for another thread with clone_for_thread, as on dev. The copy runs over a layout clone with a new Drive service, which GDriveClient builds with its new_service factory. - Inbox and outbox reading move into DriveP2PConnection, with dev's parallel receive and batched archive. delete_all moves into DriveOwnerStore. GDriveConnection only logs in and builds the layout. - Tests reach Drive through drive_layout_of(transport), which replaces gdrive_connection_of.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1 of making the P2P part of a manager's transport swappable (WebRTC next to Drive). Before this, a manager built four routers (peer manager, owner syncer, watcher syncer, watcher cache), each with its own connection and transport. Now it builds one and every part shares it.
Changes
SyftboxManager.from_configbuilds the peer store (PeerManager.peer_store_from_config) and oneConnectionRouter, then passes the router to each part'sfrom_confignext to its config.SyftboxManager.from_configand passed in as a required argument.connection_configsmoves off the four part configs ontoSyftboxManagerConfig. That field didn't exist before:for_colabpassed it and pydantic silently dropped it._set_peer_store(it rewired four routers after construction)._peer_storeis now a property that reads the router's store._add_connectionandreset_all_connection_cacheswork on one router.Tests
tests/unit/test_shared_router.py: every part shares one router and peer store,from_configbuilds exactly one connection, a mock connection is added once and backs the transport.router_without_connections().test_encryption.py: 4 passed.