|
@ -12,14 +12,13 @@ |
|
|
|
|
|
|
|
|
namespace leveldb { |
|
|
namespace leveldb { |
|
|
|
|
|
|
|
|
static uint64_t PackSequenceAndTypeAndTtlAndLookup( |
|
|
|
|
|
uint64_t seq, ValueType t, bool havettl, bool islookup) { |
|
|
|
|
|
|
|
|
static uint64_t PackSequenceAndTypeAndTtl( |
|
|
|
|
|
uint64_t seq, ValueType t, bool havettl) { |
|
|
assert(seq <= kMaxSequenceNumber); |
|
|
assert(seq <= kMaxSequenceNumber); |
|
|
assert(t <= kValueTypeForSeek); |
|
|
assert(t <= kValueTypeForSeek); |
|
|
return (seq << 8) | (islookup << 2) | (havettl << 1) | t; |
|
|
|
|
|
|
|
|
return (seq << 8) | (havettl << 1) | t; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//下面有两个调这个函数的没改,也许也要修改标志位?
|
|
|
|
|
|
static uint64_t PackSequenceAndType(uint64_t seq, ValueType t) { |
|
|
static uint64_t PackSequenceAndType(uint64_t seq, ValueType t) { |
|
|
assert(seq <= kMaxSequenceNumber); |
|
|
assert(seq <= kMaxSequenceNumber); |
|
|
assert(t <= kValueTypeForSeek); |
|
|
assert(t <= kValueTypeForSeek); |
|
@ -30,8 +29,8 @@ void AppendInternalKey(std::string* result, const ParsedInternalKey& key) { |
|
|
result->append(key.user_key.data(), key.user_key.size()); |
|
|
result->append(key.user_key.data(), key.user_key.size()); |
|
|
if(key.deadTime != 0) |
|
|
if(key.deadTime != 0) |
|
|
PutFixed64(result, key.deadTime); |
|
|
PutFixed64(result, key.deadTime); |
|
|
PutFixed64(result, PackSequenceAndTypeAndTtlAndLookup( |
|
|
|
|
|
key.sequence, key.type, (key.deadTime != 0), false)); |
|
|
|
|
|
|
|
|
PutFixed64(result, PackSequenceAndTypeAndTtl( |
|
|
|
|
|
key.sequence, key.type, (key.deadTime != 0))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
std::string ParsedInternalKey::DebugString() const { |
|
|
std::string ParsedInternalKey::DebugString() const { |
|
@ -164,10 +163,10 @@ LookupKey::LookupKey(const Slice& user_key, SequenceNumber s, uint64_t nowTime) |
|
|
EncodeFixed64(dst, nowTime); |
|
|
EncodeFixed64(dst, nowTime); |
|
|
dst += 8; |
|
|
dst += 8; |
|
|
// EncodeFixed64(dst, PackSequenceAndTypeAndTtlAndLookup(s, kValueTypeForSeek, 0, true));
|
|
|
// EncodeFixed64(dst, PackSequenceAndTypeAndTtlAndLookup(s, kValueTypeForSeek, 0, true));
|
|
|
EncodeFixed64(dst, PackSequenceAndTypeAndTtlAndLookup(s, kValueTypeForSeek, 1, false)); |
|
|
|
|
|
|
|
|
EncodeFixed64(dst, PackSequenceAndTypeAndTtl(s, kValueTypeForSeek, 1)); |
|
|
dst += 8; |
|
|
dst += 8; |
|
|
end_ = dst; |
|
|
end_ = dst; |
|
|
printf("lookupkey tag:%lx\n",PackSequenceAndTypeAndTtlAndLookup(s, kValueTypeForSeek, 1, false)); |
|
|
|
|
|
|
|
|
printf("lookupkey tag:%lx\n",PackSequenceAndTypeAndTtl(s, kValueTypeForSeek, 1)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} // namespace leveldb
|
|
|
} // namespace leveldb
|