1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
| class Footer { public: Footer() : Footer(kInvalidTableMagicNumber, 0) {}
Footer(uint64_t table_magic_number, uint32_t version);
uint32_t version() const { return version_; }
ChecksumType checksum() const { return checksum_; } void set_checksum(const ChecksumType c) { checksum_ = c; }
const BlockHandle& metaindex_handle() const { return metaindex_handle_; } void set_metaindex_handle(const BlockHandle& h) { metaindex_handle_ = h; }
const BlockHandle& index_handle() const { return index_handle_; }
void set_index_handle(const BlockHandle& h) { index_handle_ = h; }
uint64_t table_magic_number() const { return table_magic_number_; }
void EncodeTo(std::string* dst) const;
Status DecodeFrom(Slice* input);
enum { kVersion0EncodedLength = 2 * BlockHandle::kMaxEncodedLength + 8, kNewVersionsEncodedLength = 1 + 2 * BlockHandle::kMaxEncodedLength + 4 + 8, kMinEncodedLength = kVersion0EncodedLength, kMaxEncodedLength = kNewVersionsEncodedLength, };
static const uint64_t kInvalidTableMagicNumber = 0;
std::string ToString() const;
private: void set_table_magic_number(uint64_t magic_number) { assert(!HasInitializedTableMagicNumber()); table_magic_number_ = magic_number; }
bool HasInitializedTableMagicNumber() const { return (table_magic_number_ != kInvalidTableMagicNumber); }
uint32_t version_; ChecksumType checksum_; BlockHandle metaindex_handle_; BlockHandle index_handle_; uint64_t table_magic_number_ = 0; };
|