-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Flatfs #1035
Flatfs #1035
Conversation
FSRepo.Open is dead since fdd1cd8
This allows replacing the datastore without needing to write Close through to every wrapped datastore.
WARNING: No migration performed! That needs to come in a separate commit, perhaps amended into this one. Migration must move keyspace "/b" from leveldb to the flatfs subdir, while removing the "b" prefix (keys should start with just "/").
@whyrusleeping btw, i dont want to merge anything that breaks the repo into master without the migration. see discussion in #975 (comment) so
|
thus me saying "not intending to merge this" |
var padding = strings.Repeat("_", maxPrefixLen*hex.EncodedLen(1)) | ||
|
||
func (fs *Datastore) encode(key datastore.Key) (dir, file string) { | ||
safe := hex.EncodeToString(key.Bytes()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbenet thoughts on doing:
safe := hex.EncodeToString(key.Bytes()[1:])
to trim off the leading "/" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(note btw, that this way of doing things is not compatible with queries with prefixes. one way to do that is encoding each path component separately.) @tv42 and I discussed a while back and figured it'd be fine to leave it as is until we want to put anything other than blocks in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbenet You mean because the prefixes wouldn't necessarily align with the directory sharding done here? I think prefix search would be still doable, it just might have to iterate multiple of these shard directories. It won't perform very well, as it'll need to filter out a ton of non-matches, though.
Not intending to merge this yet, just wanted to get some review and run the tests