Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

由于Template由EntityMNode进行使用,因此在EntityMNode中增加Map<String, ILastCacheEntry>字段,用于存储template所表示的时间序列的lastCache。ILastCacheContainer>字段,用于存储template所表示的时间序列的lastCache。

对MeasurementMNode中的lastCache进行操作时,先判断该节点是否是为了template而创建的临时节点,如果是,则先拿到entityMNode中的lastCache引用,然后再进行操作。

...

2.3. LastCache方案详情

2.3.1. 设计思路

  1. 为了提升功能代码的内聚性,通过设计ILastCacheEntry接口,将LastCache操作与MNode解耦,由LasCacheEntry实现ILastCacheEntry接口,并封装lastCache数据,同时提供简单的lastCacheValue操作。为了提升功能代码的内聚性,通过设计ILastCacheContainer接口,将LastCache操作与MNode解耦,由LasCacheContainer实现ILastCacheContainer接口,并封装lastCache数据,同时提供简单的lastCacheValue操作。
  2. 新建LastCacheManager,将MManager中与lastCache相关的操作代码尽可能迁移至 LastCacheManager,MManager中仅保留必要的mtree调用以及mnode获取操作。
  3. EntityMNode中增加Map<String, ILastCacheEntry>字段,用于存储template中序列的lastCache;MeasurementMNode中将原来的TimeValuePair替换为ILastCacheEntry,用于存储普通序列的lastCache。ILastCacheContainer>字段,用于存储template中序列的lastCache;MeasurementMNode中将原来的TimeValuePair替换为ILastCacheContainer,用于存储普通序列的lastCache。

2.3.2. 类设计

Image RemovedImage Added


类名

职责

StorageGroupProccessor

与MManager进行交互,在数据插入、数据删除以及上传新tsfile的时候清空对应序列的lastCache

LastQueryExecutor

Last查询执行类,调用MManager进行lastCache操作

MManager

  1. 对IoTDB的其他模块提供lastCache的操作接口
  2. 为LastCacheManager提供node查找功能

IEntityMNode与EntityMNode

实体节点,存储由物理量模板所表示的时间序列的lastCache,即Map<String, ILastCacheEntry>ILastCacheContainer>

IMeasurementMNode与MeasurementMNode

物理量节点,手动创建时间序列时产生,存储其表示的时间序列的lastCache

LastCacheManager

封装所有的lastCache处理逻辑,并向mmanager提供lastCache操作接口

ILastCacheEntryLastCacheContainer

最新点缓存项接口,声明最新点缓存的操作接口

LastCacheEntryastCacheContainer

实现ILastCacheEntry,定义对于一个最新点缓存值的基本操作实现ILastCacheContainer,定义对于一个最新点缓存值的基本操作

ILastCacheValue

最新点缓存值接口,声明

MonadLastCacheValueUnaryLastCacheValue

一元序列的最新点缓存值

VectorLastCacheValue

多元序列的最新点缓存值,存储各分量对应的最新点的时间戳与数值


2.4. LastCache扩展方向

  1. LastCache缓存多条数据,LastCacheEntry向BatchedLastCacheEntry扩展LastCache缓存多条数据,LastCacheContainer向BatchedLastCacheContainer扩展
  2. 底层实现重写,如lastCache存储Memtable中最新的批量数据