/images/avatar.jpg

Wonder how much further I'll go.

LevelDB Cache

Cacheleveldb 以虚函数的形式定义了 cahce 所应该具有的功能,具体 cache 策略的实现应该继承 Cache 类并实现其虚函数。 namespace leveldb { class LEVELDB_EXPORT Cache { public: Cache() = default; Cache(const Cache&) = delete; Cache& operator=(const Cache&) = delete; // Destroys all existing entries by calling

TiDB 物理优化

physicalOptimize(WIP) func physicalOptimize(logic LogicalPlan, planCounter *PlanCounterTp) (PhysicalPlan, float64, error) { // 递归的计算并保存每一个逻辑算子的统计信息(basePlan.stats) if _, err := logic.recursiveDeriveStats(nil); err != nil { return nil, 0, err } // 引入预处理 property 函数

TiDB 逻辑优化

logicalOptimize func logicalOptimize(ctx context.Context, flag uint64, logic LogicalPlan) (LogicalPlan, error) { var err error for i, rule := range optRuleList { // The order of flags is same as the order of optRule in the list. // We use a bitmask to record which opt rules should be used. If the i-th bit is 1, it means we should // apply i-th optimizing rule. if flag&(1<<uint(i)) == 0 || isLogicalRuleDisabled(rule)

muduo TcpServer 和 TcpClient

Socket管理一个套接字(listen fd 或 connection fd),其生命周期和管理的套接字一样长。 class Socket : noncopyable { public: explicit Socket(int sockfd) : sockfd_(sockfd) { } // Socket(Socket&&) // move constructor in C++11 ~Socket(); int fd() const { return sockfd_;

muduo EventLoop

class EventLoop : noncopyable { public: typedef std::function<void()> Functor; EventLoop(); ~EventLoop(); // force out-line dtor, for std::unique_ptr members. /// Loops forever. /// Must be called in the same thread as creation of the object. void loop(); /// Quits loop. /// This is not 100% thread safe, if you call through a raw pointer, /// better to call through shared_ptr<EventLoop> for 100% safety. void quit(); ... /// Runs callback immediately in