beansdb之哈希树的分析

 

 

size_t qlz_compress(const void *source, char *destination, size_t size, qlz_state_compress *state_compress)

//Compress size amount of bytes of source and write the result to destination.返回的是压缩后的数据大小

 

size_t qlz_decompress(const char *source, void *destination, qlz_state_decompress *state_decompress)

//Decompress source and write the result to destination. 返回的是解压后的数据大小

 

size_t qlz_size_decompressed(const char *source)

//Takes the first 9 bytes of compressed data as argument (header) and returns its decompressed size.

The function can be used to allocate the correct amount of memory for decompression. 传入压缩数据的相关参数,返回的是解压后的数据大小,以便分配空间

 

size_t qlz_size_compressed(const char *source)

Takes the first 9 bytes of compressed data as argument (header) and returns its entire compressed size.

The function can be used to read a block of compressed data from a file or storage device in cases where the size of the block is unknown. 传入压缩数据的相关参数,返回的是压缩数据的大小,以便读压缩数据

038typedef struct t_data Data;//每一个节点都对应一个data,但是非叶子节点的data没有意义
039struct t_data {
040    int size;//叶子节点的data->size记录的是属于它的所有Item的大小
041    int used;//已使用的data大小,当used+新加入的item->length>size时就要增大data->size
042    int count;//记录属于它的item数目
043    Item head[0];//指向第一个Item的指针
044};

 

046typedef struct t_node Node;
047struct t_node {
048    uint16_t is_node:1;//非叶子节点则为1 ,叶子节点为0

转载于:https://my.oschina.net/yang0614/blog/13948

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值