-
Notifications
You must be signed in to change notification settings - Fork 21
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
Unable to handle keys with namespaces #22
Comments
That is true, go-ds-flatfs was never used with namespaces. IDK if it was ever planned, but we for sure shouldn't let it panic. pinging @whyrusleeping |
cc @kevina |
We can (1) Reject them in Put, this will be the simplest option (2) Escape them somehow, (3) somehow create directory entries. Note that on windows, flatfs will have problems with keys that have any of the disallowed characters in filenames on windows. I think (1) is the easiest. (2) would be more complicated and I am not sure how to escape this. The original code I believe converted the entire key to hex, but we pushed that encoding (which in now base32) up to the blockstore level. (3) is probably doable but I would not recommend as it will conflict with sharing. |
I think doing (1) reduces the usability of this package when using this as intended from datastore concept, so that is not really a fix but rather keeping it unfinished. |
@dignifiedquire flatfs is already quite specialized package because the sharding won't work unless the keys you input are spread out over keyspace. My point is flatfs is specific datastrore system that has one job and does it well. |
Note that to be really safe we have to also worry about case-insensitivity of some filesystems. Really the only really safe thing to do is to do the base32 encoding at datastore level rather then the filestore one, but then we have to use binary keys (or have to deal with encoding the CID twice) and the use of binary keys is the entire reason we moved the encoding to the blockstore level. |
This also significantly hurts the usefulness of |
Ah. Nevermind, one namespace is allowed apparently. |
@Stebalien should we close this issue? My understanding is that there is no longer a panic anymore, but that this issue is essentially a "won't fix". |
You're right. This was "fixed" in #64. |
I came across this when trying to put something with a key like
"/foo/bar"
this will result in a panic, as only thefoo
directory is created but not thebar
.Digging deeper the reason is that
encode
does not handle namespaces in keys properly.This is my current test output which shows how the sharding function messes up the namespaced key:
The text was updated successfully, but these errors were encountered: