Skip to content

Allow MemoryFileStore store copying from different a bucket#68

Open
GeorgeMattimoe wants to merge 1 commit intomainfrom
allow-memory-store-copying-from-one-bucket-to-another
Open

Allow MemoryFileStore store copying from different a bucket#68
GeorgeMattimoe wants to merge 1 commit intomainfrom
allow-memory-store-copying-from-one-bucket-to-another

Conversation

@GeorgeMattimoe
Copy link
Copy Markdown

@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
Copy Markdown
Contributor

@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.

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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.

2 participants