Repository navigation
feat: add WebRTC p2p connection over a fake channel - #9607
Open
koenvanderveen wants to merge 2 commits into
Open
koenvanderveen wants to merge 2 commits into
koenvanderveen wants to merge 2 commits into
Conversation
The real WebRTC core (queue files, receipts, duplicate check, resend on connect) runs over a FakeChannel, an in-memory pipe in place of an aiortc data channel. pair_with_mock_drive_and_mock_webrtc_connection sends messages over it while the mock Drive does peering, datasets and storage. Outbox compaction is skipped for a p2p connection that keeps no sent messages.
…est pair factories New messages wait until the channel has opened and older unconfirmed ones were resent. Each queue is a folder with one file per message, so adding or removing one never rewrites the others. The Drive and Drive+WebRTC pair factories are separate methods built from shared helpers.
This branch has not been deployed
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.
First step of the local WebRTC connection (connsplit v2). Only the data channel is faked; the WebRTC core on top of it is real, the same idea as MockDriveService for Drive.
Changes
syft/sync/connections/webrtc/:WebRTCP2PConnection(the synchronous core),Channel(the pipe under it),FakeChannel(in-memory pipe, no threads) andMessageQueue(a folder per queue, one file per message).sendwrites the outgoing file, sends the frame and returnsQUEUED. The peer stores the message in its incoming file and sends a receipt;delivered()then reports it once.pair_with_mock_drive_and_mock_webrtc_connectiononSyftboxManagerandSyftRDSClient: the mock Drive does peering, datasets and storage, WebRTC carries the messages.keeps_sent_messages, true only for Drive).Not in this PR: chunking, the
DeliveryTrackerin-flight list (the DO still counts aQUEUEDsend as delivered, which is safe whileFakeChannelreturns the receipt insidesend), the DO duplicate check, FakeChannel manual mode, the shared pair fixture and strict mode, thread safety, aiortc.Tests (new folder
tests/unit/webrtc/)test_webrtc_p2p.py: the core over a FakeChannel without managers.test_webrtc_end_to_end.py: a file round trip and a job round trip through the new factory, both checking that no message files appear in the Drive inbox, archive or outbox.just test-unit-fast: 741 passed. Pre-commit passes.