LCOV - code coverage report
Current view: top level - src/leveldb/db - version_edit.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 37 37 100.0 %
Date: 2022-04-21 14:51:19 Functions: 11 11 100.0 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 0 0 -

           Branch data     Line data    Source code
#       1                 :            : // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
#       2                 :            : // Use of this source code is governed by a BSD-style license that can be
#       3                 :            : // found in the LICENSE file. See the AUTHORS file for names of contributors.
#       4                 :            : 
#       5                 :            : #ifndef STORAGE_LEVELDB_DB_VERSION_EDIT_H_
#       6                 :            : #define STORAGE_LEVELDB_DB_VERSION_EDIT_H_
#       7                 :            : 
#       8                 :            : #include <set>
#       9                 :            : #include <utility>
#      10                 :            : #include <vector>
#      11                 :            : 
#      12                 :            : #include "db/dbformat.h"
#      13                 :            : 
#      14                 :            : namespace leveldb {
#      15                 :            : 
#      16                 :            : class VersionSet;
#      17                 :            : 
#      18                 :            : struct FileMetaData {
#      19                 :       6151 :   FileMetaData() : refs(0), allowed_seeks(1 << 30), file_size(0) {}
#      20                 :            : 
#      21                 :            :   int refs;
#      22                 :            :   int allowed_seeks;  // Seeks allowed until compaction
#      23                 :            :   uint64_t number;
#      24                 :            :   uint64_t file_size;    // File size in bytes
#      25                 :            :   InternalKey smallest;  // Smallest internal key served by table
#      26                 :            :   InternalKey largest;   // Largest internal key served by table
#      27                 :            : };
#      28                 :            : 
#      29                 :            : class VersionEdit {
#      30                 :            :  public:
#      31                 :       8952 :   VersionEdit() { Clear(); }
#      32                 :       8952 :   ~VersionEdit() = default;
#      33                 :            : 
#      34                 :            :   void Clear();
#      35                 :            : 
#      36                 :       3411 :   void SetComparatorName(const Slice& name) {
#      37                 :       3411 :     has_comparator_ = true;
#      38                 :       3411 :     comparator_ = name.ToString();
#      39                 :       3411 :   }
#      40                 :       5713 :   void SetLogNumber(uint64_t num) {
#      41                 :       5713 :     has_log_number_ = true;
#      42                 :       5713 :     log_number_ = num;
#      43                 :       5713 :   }
#      44                 :       2302 :   void SetPrevLogNumber(uint64_t num) {
#      45                 :       2302 :     has_prev_log_number_ = true;
#      46                 :       2302 :     prev_log_number_ = num;
#      47                 :       2302 :   }
#      48                 :       5713 :   void SetNextFile(uint64_t num) {
#      49                 :       5713 :     has_next_file_number_ = true;
#      50                 :       5713 :     next_file_number_ = num;
#      51                 :       5713 :   }
#      52                 :       3522 :   void SetLastSequence(SequenceNumber seq) {
#      53                 :       3522 :     has_last_sequence_ = true;
#      54                 :       3522 :     last_sequence_ = seq;
#      55                 :       3522 :   }
#      56                 :        289 :   void SetCompactPointer(int level, const InternalKey& key) {
#      57                 :        289 :     compact_pointers_.push_back(std::make_pair(level, key));
#      58                 :        289 :   }
#      59                 :            : 
#      60                 :            :   // Add the specified file at the specified number.
#      61                 :            :   // REQUIRES: This version has not been saved (see VersionSet::SaveTo)
#      62                 :            :   // REQUIRES: "smallest" and "largest" are smallest and largest keys in file
#      63                 :            :   void AddFile(int level, uint64_t file, uint64_t file_size,
#      64                 :       1945 :                const InternalKey& smallest, const InternalKey& largest) {
#      65                 :       1945 :     FileMetaData f;
#      66                 :       1945 :     f.number = file;
#      67                 :       1945 :     f.file_size = file_size;
#      68                 :       1945 :     f.smallest = smallest;
#      69                 :       1945 :     f.largest = largest;
#      70                 :       1945 :     new_files_.push_back(std::make_pair(level, f));
#      71                 :       1945 :   }
#      72                 :            : 
#      73                 :            :   // Delete the specified "file" from the specified "level".
#      74                 :        421 :   void DeleteFile(int level, uint64_t file) {
#      75                 :        421 :     deleted_files_.insert(std::make_pair(level, file));
#      76                 :        421 :   }
#      77                 :            : 
#      78                 :            :   void EncodeTo(std::string* dst) const;
#      79                 :            :   Status DecodeFrom(const Slice& src);
#      80                 :            : 
#      81                 :            :   std::string DebugString() const;
#      82                 :            : 
#      83                 :            :  private:
#      84                 :            :   friend class VersionSet;
#      85                 :            : 
#      86                 :            :   typedef std::set<std::pair<int, uint64_t>> DeletedFileSet;
#      87                 :            : 
#      88                 :            :   std::string comparator_;
#      89                 :            :   uint64_t log_number_;
#      90                 :            :   uint64_t prev_log_number_;
#      91                 :            :   uint64_t next_file_number_;
#      92                 :            :   SequenceNumber last_sequence_;
#      93                 :            :   bool has_comparator_;
#      94                 :            :   bool has_log_number_;
#      95                 :            :   bool has_prev_log_number_;
#      96                 :            :   bool has_next_file_number_;
#      97                 :            :   bool has_last_sequence_;
#      98                 :            : 
#      99                 :            :   std::vector<std::pair<int, InternalKey>> compact_pointers_;
#     100                 :            :   DeletedFileSet deleted_files_;
#     101                 :            :   std::vector<std::pair<int, FileMetaData>> new_files_;
#     102                 :            : };
#     103                 :            : 
#     104                 :            : }  // namespace leveldb
#     105                 :            : 
#     106                 :            : #endif  // STORAGE_LEVELDB_DB_VERSION_EDIT_H_

Generated by: LCOV version 0-eol-96201-ge66f56f4af6a