cob: Implement `Store::remove`

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
Alexis Sellier 2022-12-01 15:53:19 +01:00
parent 6c0c7b2969
commit 81a1ee5cc2
No known key found for this signature in database
4 changed files with 10 additions and 5 deletions

View File

@ -103,7 +103,9 @@ pub mod type_name;
pub use type_name::TypeName;
pub mod object;
pub use object::{create, get, info, list, update, CollaborativeObject, Create, ObjectId, Update};
pub use object::{
create, get, info, list, remove, update, CollaborativeObject, Create, ObjectId, Update,
};
#[cfg(test)]
mod test;

View File

@ -12,7 +12,7 @@ use thiserror::Error;
pub mod collaboration;
pub use collaboration::{
create, get, info, list, parse_refstr, update, CollaborativeObject, Create, Update,
create, get, info, list, parse_refstr, remove, update, CollaborativeObject, Create, Update,
};
pub mod storage;

View File

@ -6,7 +6,7 @@ pub mod store;
pub mod thread;
pub use change::{Actor, ActorId, Change, ChangeId};
pub use cob::{create, get, list, update};
pub use cob::{create, get, list, remove, update};
pub use cob::{
identity, object::collaboration::error, CollaborativeObject, Contents, Create, Entry, History,
ObjectId, TypeName, Update,

View File

@ -38,6 +38,8 @@ pub enum Error {
Update(#[from] cob::error::Update),
#[error("retrieve error: {0}")]
Retrieve(#[from] cob::error::Retrieve),
#[error("remove error: {0}")]
Remove(#[from] cob::error::Remove),
#[error(transparent)]
Identity(#[from] project::IdentityError),
#[error(transparent)]
@ -173,8 +175,9 @@ where
Ok(raw.len())
}
pub fn remove(&self, _id: &ObjectId) -> Result<(), Error> {
todo!();
/// Remove an object.
pub fn remove(&self, id: &ObjectId) -> Result<(), Error> {
cob::remove(self.raw, &self.whoami, T::type_name(), id).map_err(Error::from)
}
}