LevelDB 源码分析

Condition Variable与Mutex的比较
Mutexes are low-level primitives used to coordinate concurrent access to mutable data.If one thread has locked a mutex, then another thread attempting to lock that same mutex will wait until the first thread is done
https://en.cppreference.com/w/cpp/thread/condition_variable

reinterpret_cast

Features-Not-in-LevelDB

SSTable and Log Structured Storage: LevelDB

dbformat.h
1
2
3
4
5
6
7
8
9
//A helper class useful for DBImpl::Get()
class LookupKey {
...
private:
const char *start_; //user key length varint32
const char *kstart_; //user key char[klength]
const char *end_; //sequence number + value type uint64
char space_[200]; //Avoid allocation for short keys
}
1
2
3
4
5
6
7
8
9
10
struct FileMetaData {
int refs;
int allowed_seeks; // Seeks allowed until compaction
uint64_t number;
uint64_t file_size; // File size in bytes
InternalKey smallest; // Smallest internal key served by table
InternalKey largest; // Largest internal key served by table

FileMetaData() : refs(0), allowed_seeks(1 << 30), file_size(0) {}
};