- UID
- 2
- 积分
- 8682
- 帖子
- 2905
- 主题
- 199
- 论坛币
- 11763
- 威望
- 16
- EP值
- 2349
- MP值
- 15
- 阅读权限
- 200
- 注册时间
- 2011-8-3
- 在线时间
- 2597 小时
- 最后登录
- 2024-8-28
|
Implementation Guidelines
So, how to implement the file cache concepts?
1. We must have a queue to store all the cached chunks, just like the frame cache does
2. Since we use libtcas_read_specified_chunk function to read the chunks from the file, we should provide a function to allow us read from the chunks cache queue.
3. The behavior of the chunk cache queue can somewhat be similar with the frame cache queue.
4. What information should be contained in the chunk cache queue?
a) the offset of the chunk, which is used like an ID, and we use it identify whether a chunk has been cached.
b) the buffer of the chunk, in another word, the real content
5. How to know which chunks to be pre-cached?
a) We use indexStreams, and start at the very first valid frame minFrame.
b) We will pre-read n adjacent TCAS frames' corresponding chunks (the chunks may not be adjacent in the file), or just m chunks (recommended), and cache them in the queue.
c) The chunks cached will be consumed from the head of the queue (no matter whether it is the one we wanted or not), if one being consumed, one new chunk should be provided
6. How to provide and how to consume?
a) libtcas_read_specified_chunk_ex_provider to pre-read the potential chunks, and cached them in the queue
b) libtcas_read_specified_chunk_ex_consumer to actually get the chunk from the queue
|
|