radicle-surf: refactor source objects

Refactor the source data types to reuse existing logic and update to
the latest protocol.

The `Blob` and `Tree` data types are updated to be backed by `File`
and `Directory` respectively. This allows the construction of them to
be much simpler and reuse any existing logic on those types. This also
lead to the removal of `ObjectType` and `Info`.

The `Revision` type was removed in favour of using the `Revision`
trait.

The `Revisions` type was renamed to `View`, while also renaming the
`revision` module to `view`. A `View` is a simple encoding of what a
peer's "view" would look like, i.e. what references do they have. This
also required the introduction of getting free-form categories in the
reference db, i.e. `refs/<category>`, and so a `Categories` iterator
was also introduced.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny
2022-11-30 13:22:44 +00:00
parent 02321aba7c
commit b4d3bf69cf
20 changed files with 534 additions and 538 deletions
+9 -4
View File
@@ -11,13 +11,18 @@
//! [git-objects]: https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
pub mod object;
pub use object::{blob, tree, Blob, BlobContent, Info, ObjectType, Tree};
pub use object::{blob, tree, Blob, BlobContent, Tree, TreeEntry};
pub mod commit;
pub use commit::{commit, commits, Commit};
pub mod person;
mod person;
pub use person::Person;
pub mod revision;
pub use revision::Revision;
mod view;
pub use view::{view, View};
#[cfg(feature = "syntax")]
pub mod syntax;
#[cfg(feature = "syntax")]
pub use syntax::SYNTAX_SET;