Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): Bump object_store to 0.10 #4590

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrations/object_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
50 changes: 27 additions & 23 deletions integrations/object_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand All @@ -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()
Expand All @@ -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 {
Expand All @@ -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,
Expand All @@ -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",
)),
})
}
Expand Down Expand Up @@ -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",
)),
})
}

Expand Down Expand Up @@ -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
}
Expand All @@ -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();

Expand Down
Loading