Commit Graph

5 Commits

Author SHA1 Message Date
Fintan Halpenny 0bd213d15a
radicle-cob: simplify Objects and remove identifier
Objects does not need to be separated by `local` and `remotes`, it
uses `iter` internally, so all references are used regardless.

Simplify Objects by having it be a simple vector of references.

This also means that the `identifier` is not needed. This was only
required to identify the local reference, so it can now be removed.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-08 18:13:54 +00:00
Fintan Halpenny d6416c9be1
radicle-cob: remove Resource on Store
The `Store` trait had a paramter for a `Resource`. This is too
restrictive for implementations, particularly `heartwood`.

Instead, where a unique identifier is needed for the
`object::Storage`, i.e. in `create` and `update`, the identifier
becomes a parameter.

This allows the removal of passing the resource in `list`, `get` and
`changegraph`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-08 18:13:53 +00:00
Fintan Halpenny 4112b0fdc5
radicle-cob: Reference conversion from git2::Reference
It will be common for Reference to be converted from a
`git2::Reference` when one is implementing `object::Storage`.

Provide a `TryFrom` implementation between `git2::Reference` and
`Reference`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-08 14:46:52 +00:00
Fintan Halpenny 6b303bdc97
radicle-cob: Component conversions
`TypeName` and `ObjectId` are expected to be used in reference
names.

Add `From` conversions to `Component` for both of these types to make
it easier for using them with `git-ref-format`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-08 14:46:51 +00:00
Fintan Halpenny f3c4a53e1e
radicle-cob: port collaborative objects
This is a minimal port of the collaborative objects code from
radicle-link[0].

A `CollaborativeObject` is made up of a `History` of `Change`s that
are expected to be stored in a `git` backend.

The library exposes a CRU series of functions `create`, `get`, `list`,
and `update`.

This implementation differs, to previous one, in that it does not
assume any kind of identity system -- its only assumption is that
identities have an identifier and can be addressed in the `git`
database. This means that it does not require an `author` to be passed
in and it only uses the `resource` (previously `authorizing_identity`)
to store its content-address in the `Change`.

It also foregoes any caching to simplify the port and not make any
early optimisation assumptions.

[0]: https://github.com/radicle-dev/radicle-link/tree/master/cob

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-11-04 16:11:18 +00:00