Reputation: 21
This code is in leveldb to get the type of fragment type in WAL
Status Writer::AddRecord(const Slice& slice) {
RecordType type;
// Why not defined as left == slice.size();
const bool begin = (ptr == slice.data());
const bool end = (left == fragment_length);
if (begin && end) {
type = kFullType;
} else if (begin) {
type = kFirstType;
} else if (end) {
type = kLastType;
} else {
type = kMiddleType;
}
}
Why not defined as left == slice.size()?
It looks more simpler?
Upvotes: 1
Views: 42