Add owner argument to put_file()#297
Draft
hagenw wants to merge 2 commits into
Draft
Conversation
Contributor
Reviewer's GuideIntroduces an optional owner argument to put_file across backends and interfaces, wiring it through to Minio where it is persisted as object metadata while other backends accept and ignore it, and updates the Minio metadata helper to default the owner to the current user when not provided. Sequence diagram for put_file owner propagation to Minio backendsequenceDiagram
actor Client
participant UnversionedInterface as UnversionedInterface
participant BackendBase as BackendBase
participant MinioBackend as MinioBackend
participant MinioClient as MinioClient
Client->>UnversionedInterface: put_file(src_path, dst_path, owner, validate, verbose)
UnversionedInterface->>BackendBase: put_file(src_path, dst_path, owner, validate, verbose)
BackendBase->>MinioBackend: _put_file(src_path, dst_path, checksum, owner, verbose)
MinioBackend->>MinioBackend: _metadata(checksum, owner)
alt [owner is None or empty]
MinioBackend->>getpass: getpass.getuser()
MinioBackend-->>MinioBackend: owner = current_user
end
MinioBackend->>MinioClient: fput_object(..., metadata=_metadata(checksum, owner))
Flow diagram for Minio _metadata owner resolutionflowchart TD
A["_metadata(checksum, owner)"] --> B{owner provided?}
B -- Yes --> C["Use given owner"]
B -- No or empty --> D["getpass.getuser()"]
D --> E["Set owner to current user"]
C --> F["Return {checksum, owner}"]
E --> F["Return {checksum, owner}"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On S3/Minio backends we store the owner of a file in metadata, so we set it during the upload. This is handy when copying/moving files from one repository to another with the goal of preserving the original ownership.
This pull requests implements this functionality with a focus on S3/Minio.
If this is a valid argument for backends as well and we should integrate it in the official API we should decide later. Until then this pull request is marked as draft.