cob: Delete redundant functions
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
parent
e8a2432f9d
commit
6c0c7b2969
|
|
@ -13,7 +13,7 @@ use super::error;
|
||||||
/// [`crate::Change`]s at content-addressable locations. Please see
|
/// [`crate::Change`]s at content-addressable locations. Please see
|
||||||
/// [`Store`] for further information.
|
/// [`Store`] for further information.
|
||||||
///
|
///
|
||||||
/// The `typename` is the type of objects to listed.
|
/// The `typename` is the type of objects to be listed.
|
||||||
pub fn list<S>(
|
pub fn list<S>(
|
||||||
storage: &S,
|
storage: &S,
|
||||||
typename: &TypeName,
|
typename: &TypeName,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ pub mod store;
|
||||||
pub mod thread;
|
pub mod thread;
|
||||||
|
|
||||||
pub use change::{Actor, ActorId, Change, ChangeId};
|
pub use change::{Actor, ActorId, Change, ChangeId};
|
||||||
|
pub use cob::{create, get, list, update};
|
||||||
pub use cob::{
|
pub use cob::{
|
||||||
identity, object::collaboration::error, CollaborativeObject, Contents, Create, Entry, History,
|
identity, object::collaboration::error, CollaborativeObject, Contents, Create, Entry, History,
|
||||||
ObjectId, TypeName, Update,
|
ObjectId, TypeName, Update,
|
||||||
|
|
@ -13,87 +14,3 @@ pub use cob::{
|
||||||
pub use common::*;
|
pub use common::*;
|
||||||
|
|
||||||
use radicle_cob as cob;
|
use radicle_cob as cob;
|
||||||
use radicle_git_ext::Oid;
|
|
||||||
|
|
||||||
use crate::{identity::project::Identity, storage::git::Repository};
|
|
||||||
|
|
||||||
/// Create a new [`CollaborativeObject`].
|
|
||||||
///
|
|
||||||
/// The `repository` is the project this collaborative object is being
|
|
||||||
/// stored under.
|
|
||||||
///
|
|
||||||
/// The `signer` is used to cryptographically sign the changes made
|
|
||||||
/// for this update.
|
|
||||||
///
|
|
||||||
/// The `project` is used to store its content-address in the history
|
|
||||||
/// of changes for the collaborative object.
|
|
||||||
///
|
|
||||||
/// The `args` are the metadata for this [`CollaborativeObject`]
|
|
||||||
/// udpate. See [`Update`] for further information.
|
|
||||||
pub fn create<G>(
|
|
||||||
repository: &Repository,
|
|
||||||
signer: &G,
|
|
||||||
project: &Identity<Oid>,
|
|
||||||
args: Create,
|
|
||||||
) -> Result<CollaborativeObject, error::Create>
|
|
||||||
where
|
|
||||||
G: crypto::Signer,
|
|
||||||
{
|
|
||||||
let namespace = *signer.public_key();
|
|
||||||
cob::create(repository, signer, project, &namespace, args)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get a [`CollaborativeObject`], if it exists.
|
|
||||||
///
|
|
||||||
/// The `repository` is the project this collaborative object is being
|
|
||||||
/// stored under.
|
|
||||||
///
|
|
||||||
/// The `typename` is the type of object to be found, while the
|
|
||||||
/// `object_id` is the identifier for the particular object under that
|
|
||||||
/// type.
|
|
||||||
pub fn get(
|
|
||||||
repository: &Repository,
|
|
||||||
typename: &TypeName,
|
|
||||||
object_id: &ObjectId,
|
|
||||||
) -> Result<Option<CollaborativeObject>, error::Retrieve> {
|
|
||||||
cob::get(repository, typename, object_id)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// List a set of [`CollaborativeObject`].
|
|
||||||
///
|
|
||||||
/// The `repository` is the project this collaborative object is being
|
|
||||||
/// stored under.
|
|
||||||
///
|
|
||||||
/// The `typename` is the type of objects to listed.
|
|
||||||
pub fn list(
|
|
||||||
repository: &Repository,
|
|
||||||
typename: &TypeName,
|
|
||||||
) -> Result<Vec<CollaborativeObject>, error::Retrieve> {
|
|
||||||
cob::list(repository, typename)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Update an existing [`CollaborativeObject`].
|
|
||||||
///
|
|
||||||
/// The `repository` is the project this collaborative object is being
|
|
||||||
/// stored under.
|
|
||||||
///
|
|
||||||
/// The `signer` is used to cryptographically sign the changes made
|
|
||||||
/// for this update.
|
|
||||||
///
|
|
||||||
/// The `project` is used to store its content-address in the history
|
|
||||||
/// of changes for the collaborative object.
|
|
||||||
///
|
|
||||||
/// The `args` are the metadata for this [`CollaborativeObject`]
|
|
||||||
/// udpate. See [`Update`] for further information.
|
|
||||||
pub fn update<G>(
|
|
||||||
repository: &Repository,
|
|
||||||
signer: &G,
|
|
||||||
project: &Identity<Oid>,
|
|
||||||
args: Update,
|
|
||||||
) -> Result<CollaborativeObject, error::Update>
|
|
||||||
where
|
|
||||||
G: crypto::Signer,
|
|
||||||
{
|
|
||||||
let namespace = *signer.public_key();
|
|
||||||
cob::update(repository, signer, project, &namespace, args)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ where
|
||||||
self.raw,
|
self.raw,
|
||||||
signer,
|
signer,
|
||||||
&self.project,
|
&self.project,
|
||||||
|
signer.public_key(),
|
||||||
Update {
|
Update {
|
||||||
object_id,
|
object_id,
|
||||||
history_type: HISTORY_TYPE.to_owned(),
|
history_type: HISTORY_TYPE.to_owned(),
|
||||||
|
|
@ -125,6 +126,7 @@ where
|
||||||
self.raw,
|
self.raw,
|
||||||
signer,
|
signer,
|
||||||
&self.project,
|
&self.project,
|
||||||
|
signer.public_key(),
|
||||||
Create {
|
Create {
|
||||||
history_type: HISTORY_TYPE.to_owned(),
|
history_type: HISTORY_TYPE.to_owned(),
|
||||||
typename: T::type_name().clone(),
|
typename: T::type_name().clone(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue