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

Support prefix on S3 object names #213

Merged
merged 5 commits into from
Nov 13, 2018
Merged

Conversation

acj
Copy link
Contributor

@acj acj commented Oct 20, 2018

Currently, all objects in S3 are placed in the root of the bucket. This makes tusd adoption difficult for existing applications that use a different convention, such as using S3's support for prefixes to place objects in a pseudo-directory like s3://my_bucket/media/incoming/<upload id>. This PR introduces an ObjectPrefix field on S3Store to enable the use of prefixes.

Addresses one of the requests in #207.

@acj
Copy link
Contributor Author

acj commented Nov 10, 2018

@Acconut - when you have time, I'd love to get some feedback on this.

@Acconut
Copy link
Member

Acconut commented Nov 10, 2018

I'm sorry for the delay, I thought I commented on it literally a few hours ago. But maybe I just missed the submit button.

Anyways, I wanted to ask for your reasoning behind this PR. I was wondering about it since the referenced issue #207 took another approach.

@acj
Copy link
Contributor Author

acj commented Nov 11, 2018

No worries. My reasoning is mostly what I mentioned above — established applications that have a large collection of existing objects in a directory (prefix) may want newly uploaded files to be placed in that same directory. In our case, the directory is a long-used convention that realistically can't be changed. tusd doesn't currently provide a solution for this since all files are placed at the root of the bucket, and there's no way to override that behavior. My goal here is to provide a simple, non-breaking parameter that solves that problem.

Regarding the other PR, we experimented with using a post-upload hook to move/rename the uploaded files into our existing directory, but the operation was far too slow and unpredictable for our use case.

@Acconut Acconut merged commit 27c9c4a into tus:master Nov 13, 2018
@Acconut
Copy link
Member

Acconut commented Nov 13, 2018

Thank you for the detailed information and the nice PR 👍 I am happy to incorporate this feature into tusd.

@ridhozhr10
Copy link

guys, i just trying to make this available too in gcs store. and i discover when using prefix with underscore, i get bug because when creating chunk, idx suffix is splitted with underscore.

i think its best to validate prefix name first in startup

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.

3 participants