Skip to content

K2GO-577 feat(share): move ZIMs with rsync, write in place and resume - #787

Merged
luisguzman-adfa merged 9 commits into
mainfrom
feat/K2GO-577-share-rsync
Nov 16, 2026
Merged

luisguzman-adfa merged 9 commits into
mainfrom
feat/K2GO-577-share-rsync

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

What changes

  • conex-core 0.4.0: while a share session is open, the box runs an rsync daemon (port 9873) with one read-only module per ZIM. The module password is the session token. The share manifest advertises the module per item. The last session close stops the daemon.
  • Receiver: POST /v1/import/item with a source pulls the ZIM straight into place (rsync --inplace --append-verify), then renames it into the zims dir. A drop or a cancel keeps the bytes in /library/.conex-partial; a Retry resumes from them.
  • App: the receiver asks its own box to pull through a loopback relay on the hotspot network, and reports progress to the sender (POST /v1/share/<id>/progress). A box with an older core uses the HTTP fetch.
  • dash-node 1.6.3: the /v1 relay forwards X-Share-Token, so the sender's close works.
  • Exposure doc: the rsync listener while a session is open.

Why

  • Share staged a full copy of each item before the import and restarted from zero after a drop. A large ZIM must be written once, in place, and resume after a cut. (K2GO-577)

Steps to QA

  • Baseline (main): share a ZIM over Wi-Fi, cut the link mid-transfer, tap Retry. The item starts again from 0, and /library/.conex-staging holds a full copy during the transfer.
  • Change: both boxes run conex-core 0.4.0 (deploy it to /opt/conex-core until a rootfs ships it), the receiver runs this build. Share a ZIM, cut the link mid-transfer, tap Retry. The item resumes from the kept bytes, the md5 is equal on both phones, and /library/.conex-staging stays empty.

Verifications

  • conex-core unit tests: 240 OK (23 new). App contentexchange unit tests: OK.
  • OPPO + OnePlus 7T: cut at 131 MB, Retry resumed from 131 MB, md5 equal on both phones; the sender session closed and its daemon stopped. Evidence goes to the Jira ticket.
  • Deferred: Kolibri over rsync (next PR); resume of a multi-GB partial on a slow phone; an IIAB host firewall must admit TCP 9873.
  • Coordination: a box gets conex-core 0.4.0 only with a new rootfs or the planned conex-core live update, so mixed versions use the HTTP fetch.

Notes

  • No new UI strings.

The sender's close DELETE lost its token in the relay and got 401, so the
share stayed open after Done.
… place

A share session runs an rsync daemon module per ZIM (password = session token); the receiver
pulls straight into place and resumes from kept bytes. No staging copy. conex-core 0.4.0.
…elay

The receiver asks its box to pull a Share item the sender offers over rsync, relayed on the
hotspot network, and reports progress to the sender. A box that cannot pull uses the HTTP fetch.
…partials per pull

A stale module list could land last and keep a closed session's module serving.
Restart a dead share daemon on manifest or progress, anchor the pull rate after a resume, report
done with real bytes, and send progress off the import thread.
In a pull the parent rsync is the generator and moves almost nothing, so a long single-file
transfer looked stalled to the watchdog.
A pull orphaned by a core crash kept writing the partial, so a Retry could start a second writer
on the same file.
A partial the user will not resume no longer holds the disk until the 48 h sweep. A drop or a
Retry keeps it.
@luisguzman-adfa
luisguzman-adfa merged commit 625aef3 into main Nov 16, 2026
5 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the feat/K2GO-577-share-rsync branch November 16, 2026 22:44
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