use thiserror::Error; use offline_web_model::Reference; #[derive(Error, Debug)] pub enum StoreError { #[error("No such reference")] NoSuchReference, #[error("No such content address")] NoSuchContentAddress, #[error("Unknown Storage Error: {0:?}")] StorageError(Box), } #[allow(async_fn_in_trait)] pub trait ReferenceStore { async fn get_reference(&self, id: &str) -> Result; async fn get_content_for_reference(&self, reference: Reference) -> Result; async fn get_graph(&self, root_name: &str) -> Result, StoreError>; } mod sqlite; pub use sqlite::SqliteReferenceStore; #[cfg(test)] mod integration_tests;