wavelength 1.0.0
Loading...
Searching...
No Matches
BlockMgr.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <vector>
5
6#include "os/ArkFile.h"
7#include "os/AsyncTask.h"
8#include "os/Block.h"
9#include "os/BlockRequest.h"
10
17class BlockMgr {
18public:
24 void Init();
25
36 void
37 GetAssociatedBlocks(__int64 offset, int bytes, int &firstBlock, int &numBlocks, int &blockSize);
38
47
55 char *GetBlockData(int blockNum);
56
63 void AddRequest(const AsyncTask &task);
64
71 void Poll();
72
80 Block *FindBlock(int blockNum);
81
89
90 std::list<BlockRequest> mRequests;
91 std::vector<Block *> mBlocks;
93 int mSectorsPerBlock;
94};
95
101extern BlockMgr TheBlockMgr;
BlockMgr TheBlockMgr
The disc cache.
Read-only file of the main archive, read through the disc cache.
Definition arkfile.h:11
Cache of disc blocks that ArkFile reads go through.
Definition blockmgr.h:142
Block * mLoadingBlock
Definition BlockMgr.h:92
Block * FindBlock(int blockNum)
Find the buffer of a block.
Block * GetOldestBlock()
Find the least recently used buffer.
char * GetBlockData(int blockNum)
Report the data of a loaded block and mark the block as just used.
void AddRequest(const AsyncTask &task)
Queue a read on the request of its block, creating the request when needed.
void GetAssociatedBlocks(__int64 offset, int bytes, int &firstBlock, int &numBlocks, int &blockSize)
Report the blocks a range of the archive covers.
void Init()
Take the block buffers.
void KillBlockRequests(ArkFile *file)
Drop every waiting read of a file, and every request left with no read unless its block is loading.
void Poll()
Finish the loading block and satisfy its reads, then start loading the next requested block.
One block buffer of the disc cache.
Definition blockmgr.h:15
One part of an ArkFile read, which a single block of the disc satisfies.
Definition blockmgr.h:86