Skip to content

User-friendly keys #40

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

Closed
Stebalien opened this issue May 8, 2018 · 5 comments
Closed

User-friendly keys #40

Stebalien opened this issue May 8, 2018 · 5 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@Stebalien
Copy link
Member

Two proposals (assuming we don't deprecate this datastore soon):

  1. Handle base32 encoding internally. Forcing the client to deal with filesystem name restrictions is painful and unnecessary.
  2. Shard using a non-cryptographic hash function. We could, e.g., use SipHash (at most 50ns per hash versus 4000ns to open a file). Again, we shouldn't be making assumptions about keys specified by the user.

This way, we'd map key to Base32(FastHash(key))[:2] + "/" + Base32(key).

@Stebalien Stebalien added the kind/enhancement A net-new feature or improvement to an existing feature label May 8, 2018
@kevina
Copy link
Contributor

kevina commented May 8, 2018

We originally used binary keys and encoded to base16 in flatfs, that created some serious problems, see ipfs/kubo#2601 for context.

@Stebalien
Copy link
Member Author

Well, yes, we shouldn't be mangling keys. I'd just treat them as byte strings.

@kevina
Copy link
Contributor

kevina commented May 8, 2018

The problem was that we use '/' as a path separator in datastore keys, that does not mix well when the key itself in binary, so we changed from using binary keys to text and encoded them to base32 before converting them to datastore keys.

@Stebalien
Copy link
Member Author

Not sure if I understand. The / path separator used in keys shouldn't be reflected on-disk.

@aschmahmann
Copy link
Contributor

Looks like this was closed by @Stebalien in #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants