youngsofun commented on code in PR #3713:
URL:
https://github.com/apache/incubator-opendal/pull/3713#discussion_r1414981842
##########
integrations/object_store/src/lib.rs:
##########
@@ -88,24 +91,39 @@ impl ObjectStore for OpendalStore {
})
}
- async fn get_opts(&self, location: &Path, _: GetOptions) ->
Result<GetResult> {
- let r = self
+ 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",
+ )),
+ })
+ }
+
+ async fn get(&self, location: &Path) -> Result<GetResult> {
+ let meta = self
.inner
- .reader(location.as_ref())
+ .stat(location.as_ref())
.await
.map_err(|err| format_object_store_error(err, location.as_ref()))?;
- Ok(GetResult::Stream(Box::pin(OpendalReader { inner: r })))
- }
-
- async fn get(&self, location: &Path) -> Result<GetResult> {
+ let meta = ObjectMeta {
+ location: location.clone(),
+ last_modified: meta.last_modified().unwrap_or_default(),
+ size: meta.content_length() as usize,
+ e_tag: None,
+ };
let r = self
.inner
.reader(location.as_ref())
.await
.map_err(|err| format_object_store_error(err, location.as_ref()))?;
- Ok(GetResult::Stream(Box::pin(OpendalReader { inner: r })))
+ Ok(GetResult {
+ payload: GetResultPayload::Stream(Box::pin(OpendalReader { inner:
r })),
+ range: (0..meta.size),
Review Comment:
yes, since no option for this.
##########
integrations/object_store/src/lib.rs:
##########
@@ -88,24 +91,39 @@ impl ObjectStore for OpendalStore {
})
}
- async fn get_opts(&self, location: &Path, _: GetOptions) ->
Result<GetResult> {
- let r = self
+ 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",
+ )),
+ })
+ }
+
+ async fn get(&self, location: &Path) -> Result<GetResult> {
+ let meta = self
.inner
- .reader(location.as_ref())
+ .stat(location.as_ref())
.await
.map_err(|err| format_object_store_error(err, location.as_ref()))?;
- Ok(GetResult::Stream(Box::pin(OpendalReader { inner: r })))
- }
-
- async fn get(&self, location: &Path) -> Result<GetResult> {
+ let meta = ObjectMeta {
+ location: location.clone(),
+ last_modified: meta.last_modified().unwrap_or_default(),
+ size: meta.content_length() as usize,
+ e_tag: None,
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]