mirror of
https://github.com/google/leveldb.git
synced 2025-06-11 12:43:19 +08:00
Merge 14608396bd
into ac691084fd
This commit is contained in:
commit
ba5ec1afe4
@ -77,7 +77,7 @@ void MemTable::Add(SequenceNumber s, ValueType type, const Slice& key,
|
|||||||
const Slice& value) {
|
const Slice& value) {
|
||||||
// Format of an entry is concatenation of:
|
// Format of an entry is concatenation of:
|
||||||
// key_size : varint32 of internal_key.size()
|
// key_size : varint32 of internal_key.size()
|
||||||
// key bytes : char[internal_key.size()]
|
// key bytes : char[key.size()]
|
||||||
// tag : uint64((sequence << 8) | type)
|
// tag : uint64((sequence << 8) | type)
|
||||||
// value_size : varint32 of value.size()
|
// value_size : varint32 of value.size()
|
||||||
// value bytes : char[value.size()]
|
// value bytes : char[value.size()]
|
||||||
@ -106,7 +106,7 @@ bool MemTable::Get(const LookupKey& key, std::string* value, Status* s) {
|
|||||||
if (iter.Valid()) {
|
if (iter.Valid()) {
|
||||||
// entry format is:
|
// entry format is:
|
||||||
// klength varint32
|
// klength varint32
|
||||||
// userkey char[klength]
|
// userkey char[klength - 8]
|
||||||
// tag uint64
|
// tag uint64
|
||||||
// vlength varint32
|
// vlength varint32
|
||||||
// value char[vlength]
|
// value char[vlength]
|
||||||
|
@ -33,11 +33,10 @@ void Footer::EncodeTo(std::string* dst) const {
|
|||||||
const size_t original_size = dst->size();
|
const size_t original_size = dst->size();
|
||||||
metaindex_handle_.EncodeTo(dst);
|
metaindex_handle_.EncodeTo(dst);
|
||||||
index_handle_.EncodeTo(dst);
|
index_handle_.EncodeTo(dst);
|
||||||
dst->resize(2 * BlockHandle::kMaxEncodedLength); // Padding
|
dst->resize(original_size + 2 * BlockHandle::kMaxEncodedLength); // Padding
|
||||||
PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber & 0xffffffffu));
|
PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber & 0xffffffffu));
|
||||||
PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber >> 32));
|
PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber >> 32));
|
||||||
assert(dst->size() == original_size + kEncodedLength);
|
assert(dst->size() == original_size + kEncodedLength);
|
||||||
(void)original_size; // Disable unused variable warning.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Footer::DecodeFrom(Slice* input) {
|
Status Footer::DecodeFrom(Slice* input) {
|
||||||
|
Loading…
Reference in New Issue
Block a user