radicle: add cob storage for MockRepository
Ensure that MockRepository can be used where the COB storage traits are required. Currently, the implementations of the methods themselves are not required -- they are left as `todo!()`. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
a1b41542b8
commit
8239a1d0ac
|
|
@ -1,4 +1,5 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::convert::Infallible;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
@ -313,3 +314,87 @@ impl SignRepository for MockRepository {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl radicle_cob::Store for MockRepository {}
|
||||||
|
|
||||||
|
impl radicle_cob::object::Storage for MockRepository {
|
||||||
|
type ObjectsError = Infallible;
|
||||||
|
type TypesError = Infallible;
|
||||||
|
type UpdateError = Infallible;
|
||||||
|
type RemoveError = Infallible;
|
||||||
|
|
||||||
|
fn objects(
|
||||||
|
&self,
|
||||||
|
_typename: &radicle_cob::TypeName,
|
||||||
|
_object_id: &radicle_cob::ObjectId,
|
||||||
|
) -> Result<radicle_cob::object::Objects, Self::ObjectsError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn types(
|
||||||
|
&self,
|
||||||
|
_typename: &radicle_cob::TypeName,
|
||||||
|
) -> Result<
|
||||||
|
std::collections::BTreeMap<radicle_cob::ObjectId, radicle_cob::object::Objects>,
|
||||||
|
Self::TypesError,
|
||||||
|
> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update(
|
||||||
|
&self,
|
||||||
|
_identifier: &radicle_crypto::PublicKey,
|
||||||
|
_typename: &radicle_cob::TypeName,
|
||||||
|
_object_id: &radicle_cob::ObjectId,
|
||||||
|
_entry: &radicle_cob::EntryId,
|
||||||
|
) -> Result<(), Self::UpdateError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove(
|
||||||
|
&self,
|
||||||
|
_identifier: &radicle_crypto::PublicKey,
|
||||||
|
_typename: &radicle_cob::TypeName,
|
||||||
|
_object_id: &radicle_cob::ObjectId,
|
||||||
|
) -> Result<(), Self::RemoveError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl radicle_cob::change::Storage for MockRepository {
|
||||||
|
type StoreError = radicle_cob::git::change::error::Create;
|
||||||
|
type LoadError = radicle_cob::git::change::error::Load;
|
||||||
|
type ObjectId = Oid;
|
||||||
|
type Parent = Oid;
|
||||||
|
type Signatures = radicle_cob::signatures::ExtendedSignature;
|
||||||
|
|
||||||
|
fn store<G>(
|
||||||
|
&self,
|
||||||
|
_resource: Option<Self::Parent>,
|
||||||
|
_related: Vec<Self::Parent>,
|
||||||
|
_signer: &G,
|
||||||
|
_template: radicle_cob::change::Template<Self::ObjectId>,
|
||||||
|
) -> Result<
|
||||||
|
radicle_cob::change::store::Entry<Self::Parent, Self::ObjectId, Self::Signatures>,
|
||||||
|
Self::StoreError,
|
||||||
|
>
|
||||||
|
where
|
||||||
|
G: radicle_crypto::Signer,
|
||||||
|
{
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn load(
|
||||||
|
&self,
|
||||||
|
_id: Self::ObjectId,
|
||||||
|
) -> Result<
|
||||||
|
radicle_cob::change::store::Entry<Self::Parent, Self::ObjectId, Self::Signatures>,
|
||||||
|
Self::LoadError,
|
||||||
|
> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parents_of(&self, _id: &Oid) -> Result<Vec<Oid>, Self::LoadError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue