todo:put_object

This commit is contained in:
weisd
2024-06-28 18:13:50 +08:00
parent 4c7c3d4c96
commit 064a180b3a
15 changed files with 868 additions and 245 deletions
+32 -2
View File
@@ -1,9 +1,39 @@
use std::sync::Arc;
use anyhow::Result;
use bytes::Bytes;
use futures::Stream;
pub struct MakeBucketOptions {}
use crate::stream::DynByteStream;
pub struct MakeBucketOptions {
pub force_create: bool,
}
pub struct PutObjReader {
// pub stream: Box<dyn Stream<Item = Bytes>>,
}
// impl PutObjReader {
// pub fn new<S: Stream>(stream: S) -> Self {
// PutObjReader { stream }
// }
// }
pub struct ObjectOptions {
// Use the maximum parity (N/2), used when saving server configuration files
pub max_parity: bool,
}
#[async_trait::async_trait]
pub trait StorageAPI {
async fn make_bucket(&self, bucket: &str, opts: &MakeBucketOptions) -> Result<()>;
async fn put_object(&self, bucket: &str, objcet: &str) -> Result<()>;
async fn put_object(
&self,
bucket: &str,
object: &str,
data: &PutObjReader,
opts: &ObjectOptions,
) -> Result<()>;
}