This type that was wrapping `Message` isn't very useful here.
If we decide that we do need something like that, it's best handled one
layer below.
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
We weren't including the *multicodec* bytes previously.
This is now tested against some test vectors from the spec.
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
The `git-ref-format`[0] and `radicle-git-ext`[1] crates are now
published to crates.io.
Switch the dependency to rely on them. This also required to update
the `git2` dependency to `0.15.0` as well as using the
`vendored-libgit2` feature -- avoiding the openssl dependency too.
[0]: https://crates.io/crates/git-ref-format
[1]: https://crates.io/crates/radicle-git-ext
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Since we now have three announcement message types, we need at least
three timestamps per peer. But even that is not enough, since we don't
want to conflate ref announcements for different projects with each
other.
The solution is to also keep a map of timestamps per peer, for each
tracked project. That way we are able to know when a ref announcement is
interesting to us or not.
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
To build an address book, peers communicate via gossip, sending
`NodeAnnouncement` messages.
These need to be handled by storing the addresses in an address book
and the addresses need to be persisted to disk.
Node announcement messages should also be relayed to peers like other
gossip messages.
Armored signatures are used by Git for signing commits. Support reading
writing these signatures by implementing a new trait to read and write
to the SSH formmat.
Signed-off-by: Slack Coder <slackcoder@server.ky>
The `V` parameter of `Remote` is already determined by the `refs`
field. The `verified: PhantomData<V>` field is not required.
Remove the `verified` field to simplify the `Remote` struct.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
The previous iteration of the storage layout for projects organised
peer's subtrees by the `refs/remotes` category. This layout leads to
problems when linking a working copy to the storage project. The fetch
refspec would look something like:
fetch = +refs/remotes/abc/heads/*:refs/remotes/rad/*
This works perfectly fine when running:
git fetch rad
but will fail when one tries to specify:
git fetch rad main
Instead, the command would need to be:
git fetch remotes/abc/heads/main
This patch proposes to move the use of `refs/namespaces` for each
peer. The layout looks similar in that each peer has a subtree, but
instead it is under `refs/namespaces/<peer>/refs/...`.
The previous refspec would look more familiar in its new form:
fetch = +refs/heads/*:refs/remotes/rad/*
With this in place running:
git --namespace=abc rad main
Will work as expected and place the reference under
`refs/remotes/rad/main`. Similary, `git --namespace=abc push` will
work as expected.
Another benefit of this approach is that the use of namespacing means
that a tag is pushed it will be placed under the respective namespace
rather than in the global `refs/tags` category.
The actual implementation needed to work around the fact that
`git2`/`libgit2` does not have any options for fetching or pushing
using namespaces. The working copy code uses processes to shell out to
`git` for namespacing needs.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Adds nix tooling to allow people to develop using nix dependencies.
Uses niv to pin nixpkgs, rust-overlay, and niv itself.
This will give Rust tooling that is up to date with rustc-1.64.0.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
To be able to support git commits with multiple signature
headers, we have to implement our own parsing and formatting.
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>