mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-13 23:10:46 +08:00
Wire up the `radicle-fetch` crate to the fetch logic in the `radicle-node` worker. Any required traits for storage, identity, tracking, and transport used by `radicle-fetch`. The worker adds a new module to run the `git upload-pack` process and pipes the `stdout`/`stdin` to the respective channels. The `Worker` type required adding a `FetchConfig` to easily allow the configuration of fetches and passing the signer and tracking store location through to the fetch `Handle`. The channels code is adapted to have a new writer that always flushes when a call to `write_all` is made. This is necessary since the Gitoxide code never calls `flush`, and so it will hang since no data is sent until `flush` is called. Since `UserInfo` is used to set up a newly cloned repository, this changed some of the SHA1 hashes output in the CLI test examples. It was also necessary to update the CLI's clone code to be deterministic in its output for tests. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
2.3 KiB
2.3 KiB
Given a private repo rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu belonging to Alice,
Bob tries to clone it, and even though he's connected to Alice, it fails.
$ rad track rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu
✓ Tracking policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'trusted'
$ rad ls
$ rad sync rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --fetch --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1
✗ Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from z6MknSL…StBU8Vi.. error: failed to perform fetch handshake
✗ Error: repository fetch from 1 seed(s) failed
She allows Bob to view the repository. And when she syncs, one node (Bob) gets the refs.
$ rad id update --title "Allow Bob" --description "" --allow did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk -q
...
$ rad sync --announce --timeout 3
✓ Synced with 1 node(s)
Bob can now fetch the private repo:
$ rad sync rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --fetch
✓ Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from z6MknSL…StBU8Vi..
✓ Fetched repository from 1 seed(s)
$ rad ls --private
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Name RID Visibility Head Description │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ heartwood rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu private f2de534 radicle heartwood protocol & stack │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯