Replace GetUserKey with ExtractUserKey (#9664)

Summary:
Replace `GetUserKey` with `ExtractUserKey`

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9664

Reviewed By: jay-zhuang

Differential Revision: D34673571

Pulled By: ajkr

fbshipit-source-id: 5acf7d0d1a45efce0ccbe505991acf76c9cdc461
main
ehds@qq.com 3 years ago committed by Facebook GitHub Bot
parent 89429a9081
commit 60422f1676
  1. 6
      table/plain/plain_table_builder.h
  2. 2
      table/plain/plain_table_reader.cc
  3. 6
      table/plain/plain_table_reader.h

@ -122,17 +122,13 @@ class PlainTableBuilder: public TableBuilder {
Slice GetPrefix(const Slice& target) const { Slice GetPrefix(const Slice& target) const {
assert(target.size() >= 8); // target is internal key assert(target.size() >= 8); // target is internal key
return GetPrefixFromUserKey(GetUserKey(target)); return GetPrefixFromUserKey(ExtractUserKey(target));
} }
Slice GetPrefix(const ParsedInternalKey& target) const { Slice GetPrefix(const ParsedInternalKey& target) const {
return GetPrefixFromUserKey(target.user_key); return GetPrefixFromUserKey(target.user_key);
} }
Slice GetUserKey(const Slice& key) const {
return Slice(key.data(), key.size() - 8);
}
Slice GetPrefixFromUserKey(const Slice& user_key) const { Slice GetPrefixFromUserKey(const Slice& user_key) const {
if (!IsTotalOrderMode()) { if (!IsTotalOrderMode()) {
return prefix_extractor_->Transform(user_key); return prefix_extractor_->Transform(user_key);

@ -563,7 +563,7 @@ Status PlainTableReader::Get(const ReadOptions& /*ro*/, const Slice& target,
Status::InvalidArgument("Get() is not allowed in full scan mode."); Status::InvalidArgument("Get() is not allowed in full scan mode.");
} }
// Match whole user key for bloom filter check. // Match whole user key for bloom filter check.
if (!MatchBloom(GetSliceHash(GetUserKey(target)))) { if (!MatchBloom(GetSliceHash(ExtractUserKey(target)))) {
return Status::OK(); return Status::OK();
} }
// in total order mode, there is only one bucket 0, and we always use empty // in total order mode, there is only one bucket 0, and we always use empty

@ -179,17 +179,13 @@ class PlainTableReader: public TableReader {
Slice GetPrefix(const Slice& target) const { Slice GetPrefix(const Slice& target) const {
assert(target.size() >= 8); // target is internal key assert(target.size() >= 8); // target is internal key
return GetPrefixFromUserKey(GetUserKey(target)); return GetPrefixFromUserKey(ExtractUserKey(target));
} }
Slice GetPrefix(const ParsedInternalKey& target) const { Slice GetPrefix(const ParsedInternalKey& target) const {
return GetPrefixFromUserKey(target.user_key); return GetPrefixFromUserKey(target.user_key);
} }
Slice GetUserKey(const Slice& key) const {
return Slice(key.data(), key.size() - 8);
}
Slice GetPrefixFromUserKey(const Slice& user_key) const { Slice GetPrefixFromUserKey(const Slice& user_key) const {
if (!IsTotalOrderMode()) { if (!IsTotalOrderMode()) {
return prefix_extractor_->Transform(user_key); return prefix_extractor_->Transform(user_key);

Loading…
Cancel
Save