Support 'prefix_extractor' option?
I look at the source code and find none about 'prefix_extractor'. Will rocksdb support 'prefix_extractor' option?
A PR is welcome. I don't know what prefix_extractor is and what kind of API it would require, so it'd be best to discuss that before opening a PR, so that we can assess the complexity.
From the looks of things there are three options, via classes:
FixedPrefixTransformtakes integer optCappedPrefixTransformtakes integer optSamePrefixTransformtakes string opt
Not sure whether SamePrefixTransform is enabled - its hidden behind a GFLAGS macro check, which is not defined according to my vscode. Its also in a test file - prefix_test.cc
presumably this could be exposed to the js side as
options: {
...
prefix_extractor? : {
fixed?: number,
capped?: number,
same?: string
}
}
where ? is optional notation and only 1 of them should be be defined.
on the binding side (db_open), it would require checking which is defined (if any), and mapping to the corresponding class;
i.e.
options.prefix_extractor.reset(NewFixedPrefixTransform(2));
before being sent to the open the db.
What does it do?
Not 100% sure - but it seems it can optimize seeking/iterating when you're doing composite keys. https://github.com/facebook/rocksdb/wiki/Prefix-Seek#defining-a-prefix
I don't need this tbh - but I fancied having a gander at the code-base and tried to add it. #168