]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/table/plain/plain_table_reader.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / table / plain / plain_table_reader.h
index e3b12a9c32bb8a9081f646668ae8f1392d8225aa..62bda693aebb084a922a8ad444736e5faddb66da 100644 (file)
@@ -6,13 +6,13 @@
 #pragma once
 
 #ifndef ROCKSDB_LITE
-#include <unordered_map>
+#include <stdint.h>
+
 #include <memory>
-#include <vector>
 #include <string>
-#include <stdint.h>
+#include <unordered_map>
+#include <vector>
 
-#include "db/dbformat.h"
 #include "file/random_access_file_reader.h"
 #include "memory/arena.h"
 #include "rocksdb/env.h"
@@ -59,15 +59,15 @@ struct PlainTableReaderFileInfo {
 // The reader class of PlainTable. For description of PlainTable format
 // See comments of class PlainTableFactory, where instances of
 // PlainTableReader are created.
-class PlainTableReader: public TableReader {
+class PlainTableReader : public TableReader {
  public:
-// Based on following output file format shown in plain_table_factory.h
-// When opening the output file, PlainTableReader creates a hash table
-// from key prefixes to offset of the output file. PlainTable will decide
-// whether it points to the data offset of the first key with the key prefix
-// or the offset of it. If there are too many keys share this prefix, it will
-// create a binary search-able index from the suffix to offset on disk.
-  static Status Open(const ImmutableCFOptions& ioptions,
+  // Based on following output file format shown in plain_table_factory.h
+  // When opening the output file, PlainTableReader creates a hash table
+  // from key prefixes to offset of the output file. PlainTable will decide
+  // whether it points to the data offset of the first key with the key prefix
+  // or the offset of it. If there are too many keys share this prefix, it will
+  // create a binary search-able index from the suffix to offset on disk.
+  static Status Open(const ImmutableOptions& ioptions,
                      const EnvOptions& env_options,
                      const InternalKeyComparator& internal_comparator,
                      std::unique_ptr<RandomAccessFileReader>&& file,
@@ -110,7 +110,7 @@ class PlainTableReader: public TableReader {
     return arena_.MemoryAllocatedBytes();
   }
 
-  PlainTableReader(const ImmutableCFOptions& ioptions,
+  PlainTableReader(const ImmutableOptions& ioptions,
                    std::unique_ptr<RandomAccessFileReader>&& file,
                    const EnvOptions& env_options,
                    const InternalKeyComparator& internal_comparator,
@@ -163,13 +163,14 @@ class PlainTableReader: public TableReader {
   CacheAllocationPtr index_block_alloc_;
   CacheAllocationPtr bloom_block_alloc_;
 
-  const ImmutableCFOptions& ioptions_;
+  const ImmutableOptions& ioptions_;
   std::unique_ptr<Cleanable> dummy_cleanable_;
   uint64_t file_size_;
- protected: // for testing
+
+ protected:  // for testing
   std::shared_ptr<const TableProperties> table_properties_;
- private:
 
+ private:
   bool IsFixedLength() const {
     return user_key_len_ != kPlainTableVariableLength;
   }
@@ -180,17 +181,13 @@ class PlainTableReader: public TableReader {
 
   Slice GetPrefix(const Slice& target) const {
     assert(target.size() >= 8);  // target is internal key
-    return GetPrefixFromUserKey(GetUserKey(target));
+    return GetPrefixFromUserKey(ExtractUserKey(target));
   }
 
   Slice GetPrefix(const ParsedInternalKey& target) const {
     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 {
     if (!IsTotalOrderMode()) {
       return prefix_extractor_->Transform(user_key);