yuanrongxi / razor

A google's congestion Control Algorithm
MIT License
352 stars 152 forks source link

请教关于缓冲区的设计 #12

Closed shentu521 closed 5 years ago

shentu521 commented 5 years ago

/skiplist iterator/ typedef struct wb_skiplist_iter_s { skiplist_item_t key; skiplist_item_t val;

int depth;

struct wb_skiplist_iter_s* next[0];

}skiplist_iter_t;

最近在仔细的研究博主的这篇开源的工程,在研究缓存这里碰到了很多不明白的东西?

请问下depth的设计目的是为何? 整个缓存是怎么进行排布设计的?

shentu521 commented 5 years ago

好像是跳跃表的设计思路。。。。,在不理解思路的情况下去看源码真的好晕。。。

yuanrongxi commented 5 years ago

为了代码的独立性,我没有采用C++来实现,而是用简单的C,所以设计了一个跳表来实现KV对查找,depth是跳表的最大层级数。razor中默认是一个固定的层级数8,如果难理解可以先看看跳表的论文,再来看源码就简单了。