You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/05/11 14:27:43 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4203: Implement list_with_offset for PrefixStore

tustvold commented on code in PR #4203:
URL: https://github.com/apache/arrow-rs/pull/4203#discussion_r1191255897


##########
object_store/src/prefix.rs:
##########
@@ -59,36 +56,63 @@ impl<T: ObjectStore> PrefixStore<T> {
     }
 
     /// Strip the constant prefix from a given path
-    fn strip_prefix(&self, path: &Path) -> Option<Path> {
-        Some(path.prefix_match(&self.prefix)?.collect())
+    fn strip_prefix(&self, path: Path) -> Path {
+        // Note cannot use match because of borrow checker
+        if let Some(suffix) = path.prefix_match(&self.prefix) {
+            return suffix.collect();
+        }
+        path
+    }
+
+    /// Strip the constant prefix from a given ObjectMeta
+    fn strip_meta(&self, meta: ObjectMeta) -> ObjectMeta {
+        ObjectMeta {
+            last_modified: meta.last_modified,
+            size: meta.size,
+            location: self.strip_prefix(meta.location),
+            e_tag: meta.e_tag,
+        }
     }
 }
 
 #[async_trait::async_trait]
 impl<T: ObjectStore> ObjectStore for PrefixStore<T> {
-    async fn put(&self, location: &Path, bytes: Bytes) -> ObjectStoreResult<()> {
+    async fn put(&self, location: &Path, bytes: Bytes) -> Result<()> {
         let full_path = self.full_path(location);
         self.inner.put(&full_path, bytes).await
     }
 
+    async fn put_multipart(

Review Comment:
   These are re-ordered to match the impl order of the trait



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org