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

Allow MemoryFileStore store copying from different a bucket #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GeorgeMattimoe
Copy link

@GeorgeMattimoe GeorgeMattimoe commented May 2, 2023

Prior to this PR it was not possible to copy a file from one bucket to another in the MemoryFileStore like what can be done with the S3FileStore. Because the MemoryFileStore doesn't support copying a file from a different bucket, the MemoryFileStore cannot be used as an analogous replacement for the S3FileStore

This change updates the MemoryFileStore copy method to allow copying from one bucket to another to match the S3FileStore behaviour.

@GeorgeMattimoe GeorgeMattimoe changed the title Allow in memory store copying from different a bucket Allow MemoryFileStore store copying from different a bucket May 2, 2023
@GeorgeMattimoe GeorgeMattimoe requested a review from a team May 3, 2023 13:14
Copy link
Collaborator

@cgl cgl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is going along the right direction. I have a few comments left.

@@ -1396,8 +1396,9 @@ def list_s3_keys(self, namespace: str = "") -> Iterable[S3Object]:
return [self.get_key(path) for path in self.list_files(namespace=namespace)]

def copy(self, *, s3_object: S3Object, destination: str) -> S3Object:
source_bucket = self.buffers[s3_object.bucket_name]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📚📚📚 Shall we add a docstring to the function?

bucket_name=source_bucket_name,
key=source_key_path,
)
destination = "a/b/c.pdf"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐼 Since the original key path is called source_key_path, shall we rename this as destination_key_path?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐼 There is a nice PR description, shall we copy that as detailed explanatory text into the commit message?
Only truly trivial changes should have a one-line commit message, see: standard commit message format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants