use crate::Result;
use crate::model::{Object, ReadObjectRequest};
use crate::model_ext::WriteObjectRequest;
use crate::read_object::ReadObjectResponse;
use crate::storage::request_options::RequestOptions;
use crate::streaming_source::{Seek, StreamingSource};
use crate::{
http::HeaderMap,
model_ext::{OpenObjectRequest, ReadRange},
object_descriptor::ObjectDescriptor as Descriptor,
};
use gaxi::unimplemented::UNIMPLEMENTED;
pub trait Storage: std::fmt::Debug + Send + Sync {
fn read_object(
&self,
_req: ReadObjectRequest,
_options: RequestOptions,
) -> impl std::future::Future<Output = Result<ReadObjectResponse>> + Send {
unimplemented_stub::<ReadObjectResponse>()
}
fn write_object_buffered<P>(
&self,
_payload: P,
_req: WriteObjectRequest,
_options: RequestOptions,
) -> impl std::future::Future<Output = Result<Object>> + Send
where
P: StreamingSource + Send + Sync + 'static,
{
unimplemented_stub::<Object>()
}
fn write_object_unbuffered<P>(
&self,
_payload: P,
_req: WriteObjectRequest,
_options: RequestOptions,
) -> impl std::future::Future<Output = Result<Object>> + Send
where
P: StreamingSource + Seek + Send + Sync + 'static,
{
unimplemented_stub::<Object>()
}
fn open_object(
&self,
_request: OpenObjectRequest,
_options: RequestOptions,
) -> impl std::future::Future<Output = Result<(Descriptor, Vec<ReadObjectResponse>)>> + Send
{
unimplemented_stub::<(Descriptor, Vec<ReadObjectResponse>)>()
}
}
pub trait ObjectDescriptor: std::fmt::Debug + Send + Sync {
fn object(&self) -> Object;
fn read_range(&self, range: ReadRange) -> impl Future<Output = ReadObjectResponse> + Send;
fn headers(&self) -> HeaderMap;
}
async fn unimplemented_stub<T>() -> google_cloud_gax::Result<T> {
unimplemented!("{UNIMPLEMENTED}");
}