use std::sync::Arc;
use dyn_problem::Problem;
use futures::future::BoxFuture;
use manas_http::service::namespaced::NamespacedHttpService;
use tower::Service;
use crate::SolidStorage;
pub mod cors;
pub mod impl_;
pub mod method;
pub trait SolidStorageService:
NamespacedHttpService<hyper::Body, hyper::Body> + StorageInitializer
{
type Storage: SolidStorage;
fn storage(&self) -> &Arc<Self::Storage>;
}
pub trait SolidStorageServiceFactory: Clone + Send + Sync + Unpin + 'static {
type Storage: SolidStorage;
type Service: SolidStorageService<Storage = Self::Storage>;
fn new_service(&self, storage: Arc<Self::Storage>) -> Self::Service;
}
pub trait StorageInitializer:
Service<(), Response = bool, Error = Problem, Future = BoxFuture<'static, Result<bool, Problem>>>
{
}
impl<S> StorageInitializer for S where
S: Service<
(),
Response = bool,
Error = Problem,
Future = BoxFuture<'static, Result<bool, Problem>>,
>
{
}