Repository navigation
Conversation
- The DS saves each message to private/spool/<peer>/ before any network call, and removes it once the DO has it. The upload downgrades and encrypts the message, so it uses the DO's protocol and key at that time. - A push and sync() upload the saved messages oldest first, under a lock, so that the notebook and syft-bg do not upload a message twice. P2PConnection.is_delivered() finds a message that an upload sent before the process stopped, so it is not sent again. - The file hashes advance when a message is saved, not when it is sent, so a second edit made offline builds on the first. - A message to a peer that is not ready stays saved. The push raises and says so, and sync() warns for each peer that waits. The "not known" remedy no longer says "send again". - A spool entry carries a version, and an entry of a later version is refused.
…a lost connection - After a restart, the DS records the hashes of its saved messages again. The next edit of a path then builds on a saved edit that is not sent yet. The DO then does not refuse it as outdated. - sync() pulls before it uploads the saved messages, so a message that cannot go never holds back the results. - DriveP2PConnection.send raises ConnectionUnavailableError when Drive cannot be reached. A push then says that the change is saved and that the next sync sends it, so the user does not submit the job again. - The crash test also covers a message that the DO already archived.
… errors - SpoolEntry.message is now compressed_message, because it holds the compressed bytes of the message. - Spool.pending() is now pending_messages(). - In DatasiteWatcherSyncer, waiting is now not_ready_errors. It maps each recipient email to the error that says why its messages wait.
- P2PConnection.is_delivered() is gone. The WebRTC connection has no record of receipts after a restart, so it could not answer, and it could not be built without the method. - send() may be repeated with the same msg_id, and the peer applies the message once. Drive's send() skips a proposal that it already uploaded. The WebRTC queue already drops a repeated id while the message waits. - The spool sends each saved message and then removes it, with no separate check.
…ion check - read_versioned_json() in syft/sync/utils/versioned_file.py reads a JSON file and refuses a later version before it checks the fields. - SpoolEntry.read() and _DatasiteSettings.read() call it. Their error messages do not change.
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.
Summary
The DS saves each outgoing message to a local spool before any network call, so a dropped connection or a stopped kernel no longer loses a job submission. PR 1 of "connsplit v1.3: Scientist durability".
Changes
Spool(syft/sync/sync/spool.py): one versioned entry per message in<syftbox>/<me>/private/spool/<peer>/. The upload downgrades and encrypts the message with the peer's protocol and key at that time.sync()uploads saved messages after it pulls, oldest first, under a lock.P2PConnection.send()may be repeated with the samemsg_id. Drive skips a proposal it already uploaded, so a crash after an upload does not send it twice. WebRTC is unchanged.sync()warns. Drive unreachable: the error says the change is saved.read_versioned_json()now holds the later-version check for both the spool entry and the settings file.Testing
tests/unit/test_spool.py: restart after a failed upload, crash after upload, offline edits, edit after restart, changed DO key, stuck entry, later-version entry.test_send_before_owner_accepts_goes_once_acceptedreplaces the test that expected the change to be dropped.Asana task