| 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 |
|
| #include "db/version_edit.h" |
| 6 |
|
| |
| 7 |
|
| #include "db/version_set.h" |
| 8 |
|
| #include "util/coding.h" |
| 9 |
|
| |
| 10 |
|
| namespace leveldb { |
| 11 |
|
| |
| 12 |
|
| // Tag numbers for serialized VersionEdit. These numbers are written to |
| 13 |
|
| // disk and should not be changed. |
| 14 |
|
| enum Tag { |
| 15 |
|
| kComparator = 1, |
| 16 |
|
| kLogNumber = 2, |
| 17 |
|
| kNextFileNumber = 3, |
| 18 |
|
| kLastSequence = 4, |
| 19 |
|
| kCompactPointer = 5, |
| 20 |
|
| kDeletedFile = 6, |
| 21 |
|
| kNewFile = 7, |
| 22 |
|
| // 8 was used for large value refs |
| 23 |
|
| kPrevLogNumber = 9 |
| 24 |
|
| }; |
| 25 |
|
| |
| 26 |
17 |
| void VersionEdit::Clear() { |
| 27 |
17 |
| comparator_.clear(); |
| 28 |
17 |
| log_number_ = 0; |
| 29 |
17 |
| prev_log_number_ = 0; |
| 30 |
17 |
| last_sequence_ = 0; |
| 31 |
17 |
| next_file_number_ = 0; |
| 32 |
17 |
| has_comparator_ = false; |
| 33 |
17 |
| has_log_number_ = false; |
| 34 |
17 |
| has_prev_log_number_ = false; |
| 35 |
17 |
| has_next_file_number_ = false; |
| 36 |
17 |
| has_last_sequence_ = false; |
| 37 |
17 |
| deleted_files_.clear(); |
| 38 |
17 |
| new_files_.clear(); |
| 39 |
17 |
| } |
| 40 |
|
| |
| 41 |
8 |
| void VersionEdit::EncodeTo(std::string* dst) const { |
| 42 |
8 |
▶ | if (has_comparator_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_comparator_) { |
5 |
3 |
8 |
|
| 43 |
5 |
| PutVarint32(dst, kComparator); |
| 44 |
5 |
▶ | PutLengthPrefixedSlice(dst, comparator_); |
Branch: 1 branch
| Branch | True | False | Total |
| PutLengthPrefixedSlice(dst, comparator_); |
5 |
0 |
5 |
|
| 45 |
|
| } |
| 46 |
8 |
▶ | if (has_log_number_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_log_number_) { |
5 |
3 |
8 |
|
| 47 |
5 |
| PutVarint32(dst, kLogNumber); |
| 48 |
5 |
| PutVarint64(dst, log_number_); |
| 49 |
|
| } |
| 50 |
8 |
▶ | if (has_prev_log_number_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_prev_log_number_) { |
3 |
5 |
8 |
|
| 51 |
3 |
| PutVarint32(dst, kPrevLogNumber); |
| 52 |
3 |
| PutVarint64(dst, prev_log_number_); |
| 53 |
|
| } |
| 54 |
8 |
▶ | if (has_next_file_number_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_next_file_number_) { |
5 |
3 |
8 |
|
| 55 |
5 |
| PutVarint32(dst, kNextFileNumber); |
| 56 |
5 |
| PutVarint64(dst, next_file_number_); |
| 57 |
|
| } |
| 58 |
8 |
▶ | if (has_last_sequence_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_last_sequence_) { |
5 |
3 |
8 |
|
| 59 |
5 |
| PutVarint32(dst, kLastSequence); |
| 60 |
5 |
| PutVarint64(dst, last_sequence_); |
| 61 |
|
| } |
| 62 |
|
| |
| 63 |
8 |
▶ | for (size_t i = 0; i < compact_pointers_.size(); i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (size_t i = 0; i < compact_pointers_.size(); i++) { |
0 |
8 |
8 |
|
| 64 |
0 |
| PutVarint32(dst, kCompactPointer); |
| 65 |
0 |
| PutVarint32(dst, compact_pointers_[i].first); // level |
| 66 |
0 |
▶ | PutLengthPrefixedSlice(dst, compact_pointers_[i].second.Encode()); |
Branch: 1 branch
| Branch | True | False | Total |
| PutLengthPrefixedSlice(dst, compact_pointers_[i].second.Encode()); |
0 |
0 |
0 |
|
| 67 |
|
| } |
| 68 |
|
| |
| 69 |
8 |
| for (DeletedFileSet::const_iterator iter = deleted_files_.begin(); |
| 70 |
8 |
▶ | iter != deleted_files_.end(); |
Branch: 1 branch
| Branch | True | False | Total |
| iter != deleted_files_.end(); |
0 |
8 |
8 |
|
| 71 |
0 |
| ++iter) { |
| 72 |
0 |
▶ | PutVarint32(dst, kDeletedFile); |
Branch: 1 branch
| Branch | True | False | Total |
| PutVarint32(dst, kDeletedFile); |
0 |
0 |
0 |
|
| 73 |
0 |
▶ | PutVarint32(dst, iter->first); // level |
Branch: 1 branch
| Branch | True | False | Total |
| PutVarint32(dst, iter->first); // level |
0 |
0 |
0 |
|
| 74 |
0 |
▶ | PutVarint64(dst, iter->second); // file number |
Branch: 1 branch
| Branch | True | False | Total |
| PutVarint64(dst, iter->second); // file number |
0 |
0 |
0 |
|
| 75 |
|
| } |
| 76 |
|
| |
| 77 |
9 |
▶ | for (size_t i = 0; i < new_files_.size(); i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (size_t i = 0; i < new_files_.size(); i++) { |
1 |
8 |
9 |
|
| 78 |
1 |
| const FileMetaData& f = new_files_[i].second; |
| 79 |
1 |
| PutVarint32(dst, kNewFile); |
| 80 |
1 |
| PutVarint32(dst, new_files_[i].first); // level |
| 81 |
1 |
| PutVarint64(dst, f.number); |
| 82 |
1 |
| PutVarint64(dst, f.file_size); |
| 83 |
1 |
▶ | PutLengthPrefixedSlice(dst, f.smallest.Encode()); |
Branch: 1 branch
| Branch | True | False | Total |
| PutLengthPrefixedSlice(dst, f.smallest.Encode()); |
1 |
0 |
1 |
|
| 84 |
1 |
▶ | PutLengthPrefixedSlice(dst, f.largest.Encode()); |
Branch: 1 branch
| Branch | True | False | Total |
| PutLengthPrefixedSlice(dst, f.largest.Encode()); |
1 |
0 |
1 |
|
| 85 |
|
| } |
| 86 |
8 |
| } |
| 87 |
|
| |
| 88 |
0 |
| static bool GetInternalKey(Slice* input, InternalKey* dst) { |
| 89 |
0 |
| Slice str; |
| 90 |
0 |
▶ | if (GetLengthPrefixedSlice(input, &str)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (GetLengthPrefixedSlice(input, &str)) { |
0 |
0 |
0 |
| if (GetLengthPrefixedSlice(input, &str)) { |
0 |
0 |
0 |
|
| 91 |
0 |
▶ | dst->DecodeFrom(str); |
Branch: 1 branch
| Branch | True | False | Total |
| dst->DecodeFrom(str); |
0 |
0 |
0 |
|
| 92 |
0 |
| return true; |
| 93 |
|
| } else { |
| 94 |
0 |
| return false; |
| 95 |
|
| } |
| 96 |
|
| } |
| 97 |
|
| |
| 98 |
0 |
| static bool GetLevel(Slice* input, int* level) { |
| 99 |
|
| uint32_t v; |
| 100 |
0 |
▶ | if (GetVarint32(input, &v) && |
Branch: 3 branches
| Branch | True | False | Total |
| if (GetVarint32(input, &v) && |
0 |
0 |
0 |
| if (GetVarint32(input, &v) && |
0 |
0 |
0 |
| if (GetVarint32(input, &v) && |
0 |
0 |
0 |
|
| 101 |
0 |
▶ | v < config::kNumLevels) { |
Branch: 1 branch
| Branch | True | False | Total |
| v < config::kNumLevels) { |
0 |
0 |
0 |
|
| 102 |
0 |
| *level = v; |
| 103 |
0 |
| return true; |
| 104 |
|
| } else { |
| 105 |
0 |
| return false; |
| 106 |
|
| } |
| 107 |
|
| } |
| 108 |
|
| |
| 109 |
4 |
| Status VersionEdit::DecodeFrom(const Slice& src) { |
| 110 |
4 |
▶ | Clear(); |
Branch: 1 branch
| Branch | True | False | Total |
| Clear(); |
4 |
0 |
4 |
|
| 111 |
4 |
| Slice input = src; |
| 112 |
4 |
| const char* msg = NULL; |
| 113 |
|
| uint32_t tag; |
| 114 |
|
| |
| 115 |
|
| // Temporary storage for parsing |
| 116 |
|
| int level; |
| 117 |
|
| uint64_t number; |
| 118 |
4 |
| FileMetaData f; |
| 119 |
4 |
| Slice str; |
| 120 |
4 |
| InternalKey key; |
| 121 |
|
| |
| 122 |
17 |
▶ | while (msg == NULL && GetVarint32(&input, &tag)) { |
Branch: 4 branches
| Branch | True | False | Total |
| while (msg == NULL && GetVarint32(&input, &tag)) { |
17 |
0 |
17 |
| while (msg == NULL && GetVarint32(&input, &tag)) { |
17 |
0 |
17 |
| while (msg == NULL && GetVarint32(&input, &tag)) { |
13 |
4 |
17 |
| while (msg == NULL && GetVarint32(&input, &tag)) { |
13 |
4 |
17 |
|
| 123 |
13 |
| switch (tag) { |
| 124 |
3 |
| case kComparator: |
| 125 |
3 |
▶ | if (GetLengthPrefixedSlice(&input, &str)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (GetLengthPrefixedSlice(&input, &str)) { |
3 |
0 |
3 |
| if (GetLengthPrefixedSlice(&input, &str)) { |
3 |
0 |
3 |
|
| 126 |
3 |
▶ | comparator_ = str.ToString(); |
Branch: 1 branch
| Branch | True | False | Total |
| comparator_ = str.ToString(); |
3 |
0 |
3 |
|
| 127 |
3 |
| has_comparator_ = true; |
| 128 |
|
| } else { |
| 129 |
0 |
| msg = "comparator name"; |
| 130 |
|
| } |
| 131 |
3 |
| break; |
| 132 |
|
| |
| 133 |
3 |
| case kLogNumber: |
| 134 |
3 |
▶ | if (GetVarint64(&input, &log_number_)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (GetVarint64(&input, &log_number_)) { |
3 |
0 |
3 |
| if (GetVarint64(&input, &log_number_)) { |
3 |
0 |
3 |
|
| 135 |
3 |
| has_log_number_ = true; |
| 136 |
|
| } else { |
| 137 |
0 |
| msg = "log number"; |
| 138 |
|
| } |
| 139 |
3 |
| break; |
| 140 |
|
| |
| 141 |
1 |
| case kPrevLogNumber: |
| 142 |
1 |
▶ | if (GetVarint64(&input, &prev_log_number_)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (GetVarint64(&input, &prev_log_number_)) { |
1 |
0 |
1 |
| if (GetVarint64(&input, &prev_log_number_)) { |
1 |
0 |
1 |
|
| 143 |
1 |
| has_prev_log_number_ = true; |
| 144 |
|
| } else { |
| 145 |
0 |
| msg = "previous log number"; |
| 146 |
|
| } |
| 147 |
1 |
| break; |
| 148 |
|
| |
| 149 |
3 |
| case kNextFileNumber: |
| 150 |
3 |
▶ | if (GetVarint64(&input, &next_file_number_)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (GetVarint64(&input, &next_file_number_)) { |
3 |
0 |
3 |
| if (GetVarint64(&input, &next_file_number_)) { |
3 |
0 |
3 |
|
| 151 |
3 |
| has_next_file_number_ = true; |
| 152 |
|
| } else { |
| 153 |
0 |
| msg = "next file number"; |
| 154 |
|
| } |
| 155 |
3 |
| break; |
| 156 |
|
| |
| 157 |
3 |
| case kLastSequence: |
| 158 |
3 |
▶ | if (GetVarint64(&input, &last_sequence_)) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (GetVarint64(&input, &last_sequence_)) { |
3 |
0 |
3 |
| if (GetVarint64(&input, &last_sequence_)) { |
3 |
0 |
3 |
|
| 159 |
3 |
| has_last_sequence_ = true; |
| 160 |
|
| } else { |
| 161 |
0 |
| msg = "last sequence number"; |
| 162 |
|
| } |
| 163 |
3 |
| break; |
| 164 |
|
| |
| 165 |
0 |
| case kCompactPointer: |
| 166 |
0 |
▶ | if (GetLevel(&input, &level) && |
Branch: 3 branches
| Branch | True | False | Total |
| if (GetLevel(&input, &level) && |
0 |
0 |
0 |
| if (GetLevel(&input, &level) && |
0 |
0 |
0 |
| if (GetLevel(&input, &level) && |
0 |
0 |
0 |
|
| 167 |
0 |
▶ | GetInternalKey(&input, &key)) { |
Branch: 2 branches
| Branch | True | False | Total |
| GetInternalKey(&input, &key)) { |
0 |
0 |
0 |
| GetInternalKey(&input, &key)) { |
0 |
0 |
0 |
|
| 168 |
0 |
▶ | compact_pointers_.push_back(std::make_pair(level, key)); |
Branch: 2 branches
| Branch | True | False | Total |
| compact_pointers_.push_back(std::make_pair(level, key)); |
0 |
0 |
0 |
| compact_pointers_.push_back(std::make_pair(level, key)); |
0 |
0 |
0 |
|
| 169 |
|
| } else { |
| 170 |
0 |
| msg = "compaction pointer"; |
| 171 |
|
| } |
| 172 |
0 |
| break; |
| 173 |
|
| |
| 174 |
0 |
| case kDeletedFile: |
| 175 |
0 |
▶ | if (GetLevel(&input, &level) && |
Branch: 3 branches
| Branch | True | False | Total |
| if (GetLevel(&input, &level) && |
0 |
0 |
0 |
| if (GetLevel(&input, &level) && |
0 |
0 |
0 |
| if (GetLevel(&input, &level) && |
0 |
0 |
0 |
|
| 176 |
0 |
▶ | GetVarint64(&input, &number)) { |
Branch: 2 branches
| Branch | True | False | Total |
| GetVarint64(&input, &number)) { |
0 |
0 |
0 |
| GetVarint64(&input, &number)) { |
0 |
0 |
0 |
|
| 177 |
0 |
▶ | deleted_files_.insert(std::make_pair(level, number)); |
Branch: 2 branches
| Branch | True | False | Total |
| deleted_files_.insert(std::make_pair(level, number)); |
0 |
0 |
0 |
| deleted_files_.insert(std::make_pair(level, number)); |
0 |
0 |
0 |
|
| 178 |
|
| } else { |
| 179 |
0 |
| msg = "deleted file"; |
| 180 |
|
| } |
| 181 |
0 |
| break; |
| 182 |
|
| |
| 183 |
0 |
| case kNewFile: |
| 184 |
0 |
▶ | if (GetLevel(&input, &level) && |
Branch: 1 branch
| Branch | True | False | Total |
| if (GetLevel(&input, &level) && |
0 |
0 |
0 |
|
| 185 |
0 |
▶ | GetVarint64(&input, &f.number) && |
Branch: 2 branches
| Branch | True | False | Total |
| GetVarint64(&input, &f.number) && |
0 |
0 |
0 |
| GetVarint64(&input, &f.number) && |
0 |
0 |
0 |
|
| 186 |
0 |
▶ | GetVarint64(&input, &f.file_size) && |
Branch: 2 branches
| Branch | True | False | Total |
| GetVarint64(&input, &f.file_size) && |
0 |
0 |
0 |
| GetVarint64(&input, &f.file_size) && |
0 |
0 |
0 |
|
| 187 |
0 |
▶ | GetInternalKey(&input, &f.smallest) && |
Branch: 4 branches
| Branch | True | False | Total |
| GetInternalKey(&input, &f.smallest) && |
0 |
0 |
0 |
| GetInternalKey(&input, &f.smallest) && |
0 |
0 |
0 |
| GetInternalKey(&input, &f.smallest) && |
0 |
0 |
0 |
| GetInternalKey(&input, &f.smallest) && |
0 |
0 |
0 |
|
| 188 |
0 |
▶ | GetInternalKey(&input, &f.largest)) { |
Branch: 2 branches
| Branch | True | False | Total |
| GetInternalKey(&input, &f.largest)) { |
0 |
0 |
0 |
| GetInternalKey(&input, &f.largest)) { |
0 |
0 |
0 |
|
| 189 |
0 |
▶ | new_files_.push_back(std::make_pair(level, f)); |
Branch: 2 branches
| Branch | True | False | Total |
| new_files_.push_back(std::make_pair(level, f)); |
0 |
0 |
0 |
| new_files_.push_back(std::make_pair(level, f)); |
0 |
0 |
0 |
|
| 190 |
|
| } else { |
| 191 |
0 |
| msg = "new-file entry"; |
| 192 |
|
| } |
| 193 |
0 |
| break; |
| 194 |
|
| |
| 195 |
0 |
| default: |
| 196 |
0 |
| msg = "unknown tag"; |
| 197 |
0 |
| break; |
| 198 |
|
| } |
| 199 |
|
| } |
| 200 |
|
| |
| 201 |
4 |
▶ | if (msg == NULL && !input.empty()) { |
Branch: 3 branches
| Branch | True | False | Total |
| if (msg == NULL && !input.empty()) { |
4 |
0 |
4 |
| if (msg == NULL && !input.empty()) { |
0 |
4 |
4 |
| if (msg == NULL && !input.empty()) { |
0 |
4 |
4 |
|
| 202 |
0 |
| msg = "invalid tag"; |
| 203 |
|
| } |
| 204 |
|
| |
| 205 |
4 |
| Status result; |
| 206 |
4 |
▶ | if (msg != NULL) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (msg != NULL) { |
0 |
4 |
4 |
|
| 207 |
0 |
▶ | result = Status::Corruption("VersionEdit", msg); |
Branch: 2 branches
| Branch | True | False | Total |
| result = Status::Corruption("VersionEdit", msg); |
0 |
0 |
0 |
| result = Status::Corruption("VersionEdit", msg); |
0 |
0 |
0 |
|
| 208 |
|
| } |
| 209 |
8 |
| return result; |
| 210 |
4 |
| } |
| 211 |
|
| |
| 212 |
0 |
| std::string VersionEdit::DebugString() const { |
| 213 |
0 |
| std::string r; |
| 214 |
0 |
▶ | r.append("VersionEdit {"); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("VersionEdit {"); |
0 |
0 |
0 |
|
| 215 |
0 |
▶ | if (has_comparator_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_comparator_) { |
0 |
0 |
0 |
|
| 216 |
0 |
▶ | r.append("\n Comparator: "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n Comparator: "); |
0 |
0 |
0 |
|
| 217 |
0 |
▶ | r.append(comparator_); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append(comparator_); |
0 |
0 |
0 |
|
| 218 |
|
| } |
| 219 |
0 |
▶ | if (has_log_number_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_log_number_) { |
0 |
0 |
0 |
|
| 220 |
0 |
▶ | r.append("\n LogNumber: "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n LogNumber: "); |
0 |
0 |
0 |
|
| 221 |
0 |
▶ | AppendNumberTo(&r, log_number_); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, log_number_); |
0 |
0 |
0 |
|
| 222 |
|
| } |
| 223 |
0 |
▶ | if (has_prev_log_number_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_prev_log_number_) { |
0 |
0 |
0 |
|
| 224 |
0 |
▶ | r.append("\n PrevLogNumber: "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n PrevLogNumber: "); |
0 |
0 |
0 |
|
| 225 |
0 |
▶ | AppendNumberTo(&r, prev_log_number_); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, prev_log_number_); |
0 |
0 |
0 |
|
| 226 |
|
| } |
| 227 |
0 |
▶ | if (has_next_file_number_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_next_file_number_) { |
0 |
0 |
0 |
|
| 228 |
0 |
▶ | r.append("\n NextFile: "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n NextFile: "); |
0 |
0 |
0 |
|
| 229 |
0 |
▶ | AppendNumberTo(&r, next_file_number_); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, next_file_number_); |
0 |
0 |
0 |
|
| 230 |
|
| } |
| 231 |
0 |
▶ | if (has_last_sequence_) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (has_last_sequence_) { |
0 |
0 |
0 |
|
| 232 |
0 |
▶ | r.append("\n LastSeq: "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n LastSeq: "); |
0 |
0 |
0 |
|
| 233 |
0 |
▶ | AppendNumberTo(&r, last_sequence_); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, last_sequence_); |
0 |
0 |
0 |
|
| 234 |
|
| } |
| 235 |
0 |
▶ | for (size_t i = 0; i < compact_pointers_.size(); i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (size_t i = 0; i < compact_pointers_.size(); i++) { |
0 |
0 |
0 |
|
| 236 |
0 |
▶ | r.append("\n CompactPointer: "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n CompactPointer: "); |
0 |
0 |
0 |
|
| 237 |
0 |
▶ | AppendNumberTo(&r, compact_pointers_[i].first); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, compact_pointers_[i].first); |
0 |
0 |
0 |
|
| 238 |
0 |
▶ | r.append(" '"); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append(" '"); |
0 |
0 |
0 |
|
| 239 |
0 |
▶ | AppendEscapedStringTo(&r, compact_pointers_[i].second.Encode()); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendEscapedStringTo(&r, compact_pointers_[i].second.Encode()); |
0 |
0 |
0 |
|
| 240 |
0 |
▶ | r.append("'"); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("'"); |
0 |
0 |
0 |
|
| 241 |
|
| } |
| 242 |
0 |
| for (DeletedFileSet::const_iterator iter = deleted_files_.begin(); |
| 243 |
0 |
▶ | iter != deleted_files_.end(); |
Branch: 1 branch
| Branch | True | False | Total |
| iter != deleted_files_.end(); |
0 |
0 |
0 |
|
| 244 |
0 |
| ++iter) { |
| 245 |
0 |
▶ | r.append("\n DeleteFile: "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n DeleteFile: "); |
0 |
0 |
0 |
|
| 246 |
0 |
▶ | AppendNumberTo(&r, iter->first); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, iter->first); |
0 |
0 |
0 |
|
| 247 |
0 |
▶ | r.append(" "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append(" "); |
0 |
0 |
0 |
|
| 248 |
0 |
▶ | AppendNumberTo(&r, iter->second); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, iter->second); |
0 |
0 |
0 |
|
| 249 |
|
| } |
| 250 |
0 |
▶ | for (size_t i = 0; i < new_files_.size(); i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (size_t i = 0; i < new_files_.size(); i++) { |
0 |
0 |
0 |
|
| 251 |
0 |
| const FileMetaData& f = new_files_[i].second; |
| 252 |
0 |
▶ | r.append("\n AddFile: "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n AddFile: "); |
0 |
0 |
0 |
|
| 253 |
0 |
▶ | AppendNumberTo(&r, new_files_[i].first); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, new_files_[i].first); |
0 |
0 |
0 |
|
| 254 |
0 |
▶ | r.append(" "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append(" "); |
0 |
0 |
0 |
|
| 255 |
0 |
▶ | AppendNumberTo(&r, f.number); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, f.number); |
0 |
0 |
0 |
|
| 256 |
0 |
▶ | r.append(" "); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append(" "); |
0 |
0 |
0 |
|
| 257 |
0 |
▶ | AppendNumberTo(&r, f.file_size); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendNumberTo(&r, f.file_size); |
0 |
0 |
0 |
|
| 258 |
0 |
▶ | r.append(" '"); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append(" '"); |
0 |
0 |
0 |
|
| 259 |
0 |
▶ | AppendEscapedStringTo(&r, f.smallest.Encode()); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendEscapedStringTo(&r, f.smallest.Encode()); |
0 |
0 |
0 |
|
| 260 |
0 |
▶ | r.append("' .. '"); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("' .. '"); |
0 |
0 |
0 |
|
| 261 |
0 |
▶ | AppendEscapedStringTo(&r, f.largest.Encode()); |
Branch: 1 branch
| Branch | True | False | Total |
| AppendEscapedStringTo(&r, f.largest.Encode()); |
0 |
0 |
0 |
|
| 262 |
0 |
▶ | r.append("'"); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("'"); |
0 |
0 |
0 |
|
| 263 |
|
| } |
| 264 |
0 |
▶ | r.append("\n}\n"); |
Branch: 1 branch
| Branch | True | False | Total |
| r.append("\n}\n"); |
0 |
0 |
0 |
|
| 265 |
0 |
| return r; |
| 266 |
|
| } |
| 267 |
|
| |
| 268 |
|
| } |