You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2024/05/11 06:52:03 UTC
(opendal) branch main updated: chore(deps): Bump object_store to 0.10 (#4590)
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 210e8ae6bb chore(deps): Bump object_store to 0.10 (#4590)
210e8ae6bb is described below
commit 210e8ae6bb6f338a4222fccd0ef7e5ac242744b6
Author: TCeason <33...@users.noreply.github.com>
AuthorDate: Sat May 11 14:51:57 2024 +0800
chore(deps): Bump object_store to 0.10 (#4590)
Bump object_store to 0.10
---
integrations/object_store/Cargo.toml | 2 +-
integrations/object_store/src/lib.rs | 50 +++++++++++++++++++-----------------
2 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/integrations/object_store/Cargo.toml b/integrations/object_store/Cargo.toml
index 15b2683f81..98278adc2f 100644
--- a/integrations/object_store/Cargo.toml
+++ b/integrations/object_store/Cargo.toml
@@ -35,7 +35,7 @@ async-trait = "0.1"
bytes = "1"
futures = "0.3"
futures-util = "0.3"
-object_store = "0.9"
+object_store = "0.10.0"
opendal = { version = "0.46.0", path = "../../core" }
pin-project = "1.1"
send_wrapper = { version = "0.6", features = ["futures"], optional = true }
diff --git a/integrations/object_store/src/lib.rs b/integrations/object_store/src/lib.rs
index bfa1c633e6..c00c4e38a0 100644
--- a/integrations/object_store/src/lib.rs
+++ b/integrations/object_store/src/lib.rs
@@ -31,10 +31,12 @@ use object_store::GetOptions;
use object_store::GetResult;
use object_store::GetResultPayload;
use object_store::ListResult;
-use object_store::MultipartId;
+use object_store::MultipartUpload;
use object_store::ObjectMeta;
use object_store::ObjectStore;
+use object_store::PutMultipartOpts;
use object_store::PutOptions;
+use object_store::PutPayload;
use object_store::PutResult;
use object_store::Result;
use opendal::Entry;
@@ -43,7 +45,6 @@ use opendal::Metakey;
use opendal::Operator;
use send_wrapper::IntoSendFuture;
use send_wrapper::IntoSendStream;
-use tokio::io::AsyncWrite;
#[derive(Debug)]
pub struct OpendalStore {
@@ -65,7 +66,8 @@ impl std::fmt::Display for OpendalStore {
#[async_trait]
impl ObjectStore for OpendalStore {
- async fn put(&self, location: &Path, bytes: Bytes) -> Result<PutResult> {
+ async fn put(&self, location: &Path, bytes: PutPayload) -> Result<PutResult> {
+ let bytes: Bytes = bytes.into();
self.inner
.write(location.as_ref(), bytes)
.into_send()
@@ -80,7 +82,7 @@ impl ObjectStore for OpendalStore {
async fn put_opts(
&self,
_location: &Path,
- _bytes: Bytes,
+ _bytes: PutPayload,
_opts: PutOptions,
) -> Result<PutResult> {
Err(object_store::Error::NotSupported {
@@ -91,10 +93,7 @@ impl ObjectStore for OpendalStore {
})
}
- async fn put_multipart(
- &self,
- _location: &Path,
- ) -> Result<(MultipartId, Box<dyn AsyncWrite + Unpin + Send>)> {
+ async fn put_multipart(&self, _location: &Path) -> Result<Box<dyn MultipartUpload>> {
Err(object_store::Error::NotSupported {
source: Box::new(opendal::Error::new(
opendal::ErrorKind::Unsupported,
@@ -103,20 +102,15 @@ impl ObjectStore for OpendalStore {
})
}
- async fn abort_multipart(&self, _location: &Path, _multipart_id: &MultipartId) -> Result<()> {
- Err(object_store::Error::NotSupported {
- source: Box::new(opendal::Error::new(
- opendal::ErrorKind::Unsupported,
- "abort_multipart is not implemented so far",
- )),
- })
- }
-
- async fn get_opts(&self, _location: &Path, _options: GetOptions) -> Result<GetResult> {
+ async fn put_multipart_opts(
+ &self,
+ _location: &Path,
+ _opts: PutMultipartOpts,
+ ) -> Result<Box<dyn MultipartUpload>> {
Err(object_store::Error::NotSupported {
source: Box::new(opendal::Error::new(
opendal::ErrorKind::Unsupported,
- "get_opts is not implemented so far",
+ "put_multipart_opts is not implemented so far",
)),
})
}
@@ -153,8 +147,18 @@ impl ObjectStore for OpendalStore {
Ok(GetResult {
payload: GetResultPayload::Stream(Box::pin(stream)),
- range: (0..meta.size),
+ range: 0..meta.size,
meta,
+ attributes: Default::default(),
+ })
+ }
+
+ async fn get_opts(&self, _location: &Path, _options: GetOptions) -> Result<GetResult> {
+ Err(object_store::Error::NotSupported {
+ source: Box::new(opendal::Error::new(
+ opendal::ErrorKind::Unsupported,
+ "get_opts is not implemented so far",
+ )),
})
}
@@ -415,11 +419,11 @@ mod tests {
let path: Path = "data/test.txt".into();
let bytes = Bytes::from_static(b"hello, world!");
- object_store.put(&path, bytes).await.unwrap();
+ object_store.put(&path, bytes.into()).await.unwrap();
let path: Path = "data/nested/test.txt".into();
let bytes = Bytes::from_static(b"hello, world! I am nested.");
- object_store.put(&path, bytes).await.unwrap();
+ object_store.put(&path, bytes.into()).await.unwrap();
object_store
}
@@ -433,7 +437,7 @@ mod tests {
let path: Path = "data/test.txt".into();
let bytes = Bytes::from_static(b"hello, world!");
- object_store.put(&path, bytes.clone()).await.unwrap();
+ object_store.put(&path, bytes.clone().into()).await.unwrap();
let meta = object_store.head(&path).await.unwrap();