s3path icon indicating copy to clipboard operation
s3path copied to clipboard

Add support for symbolic links

Open techalchemy opened this issue 5 years ago • 3 comments

It is possible to support symbolic linking on S3 by relying on the native metadata field website_redirect_location. This is intended to be used with website buckets as a redirect key, so S3 won't respect it in non-website buckets, but because it is provided natively we can rely on it and use it to store references similar to how symbolic links work.

In other similar distributed filesystems, this works with an empty, 0 length binary string as the file contents, accompanied by the relevant header stored in metadata (in this case, x-amz-website-redirect-location). IT would then be on the implementation to check whether a path is referring to a symbolic link or not during relevant operations, e.g. read() or during directory traversals.

techalchemy avatar Jun 08 '20 21:06 techalchemy

I will open a PR with an implementation and tests in case you are interested in accepting this change. Happy to make adjustments as well. Thanks!

techalchemy avatar Jun 08 '20 21:06 techalchemy

Cool stuff @techalchemy!

Very interesting idea :-)

I am curious to see the use case for this symbolic in buckets in the backend.

Nonetheless, I'm down with this feature :-)

We are currently validating before most of the S3Path methods if the path is an absolute path. (a requirement in S3 - you have to have: "/bucket-name/[key-prefix/|key]") Can we add this kind of validation to detect if the bucket is an website buckets bucket type? This way, we won't support Symbolic Links if the bucket isn't configured as a website buckets.

liormizr avatar Jun 10 '20 14:06 liormizr

Hi @techalchemy I'm planning a big version I want to add your feature as well Should I continue without you? or do you want to continue pushing it?

liormizr avatar Dec 30 '20 10:12 liormizr