2004-06-30 01:09:57 +00:00
|
|
|
#ifndef __PAGECACHE_H
|
|
|
|
#define __PAGECACHE_H
|
|
|
|
|
2004-07-23 20:21:44 +00:00
|
|
|
#include <lladd/bufferManager.h>
|
|
|
|
|
2006-04-14 03:45:26 +00:00
|
|
|
//Page * getPage(int pageid, int locktype);
|
2004-06-30 01:09:57 +00:00
|
|
|
/**
|
|
|
|
Implements lladd's caching policy. Looks up pageid in the cache.
|
|
|
|
If pageid doesn't exist, then allocate a new slot for it. If
|
|
|
|
there are no new slots, then callback into bufferManager's
|
|
|
|
pageRead() function. Eventually, this could be extended to
|
|
|
|
support application specific caching schemes.
|
|
|
|
|
|
|
|
If you would like to implement your own caching policy, implement
|
2007-03-08 07:56:53 +00:00
|
|
|
the functions below. They are relatively straightforward.
|
2004-06-30 01:09:57 +00:00
|
|
|
Note that pageCache does not perform any file I/O of its own.
|
|
|
|
|
2007-03-08 07:56:53 +00:00
|
|
|
The implementation of this module does not need to be threadsafe.
|
|
|
|
|
2007-06-01 21:06:18 +00:00
|
|
|
@param first The caller should manually read this page by calling
|
|
|
|
pageRead() before calling pageCacheInit.
|
|
|
|
|
|
|
|
@todo pageCacheInit should not take a page as a parameter.
|
2004-07-14 21:25:59 +00:00
|
|
|
|
2004-06-30 01:09:57 +00:00
|
|
|
*/
|
2007-03-08 07:56:53 +00:00
|
|
|
|
2004-07-27 01:04:35 +00:00
|
|
|
void pageCacheInit(Page * first);
|
2004-06-30 01:09:57 +00:00
|
|
|
void pageCacheDeinit();
|
2004-07-27 01:04:35 +00:00
|
|
|
|
|
|
|
void cacheHitOnPage(Page * ret);
|
|
|
|
void cacheRemovePage(Page * ret);
|
|
|
|
void cacheInsertPage (Page * ret);
|
|
|
|
/** Return a page that is a reasonable candidate for replacement. This
|
|
|
|
function does not actually remove the page from cache.*/
|
|
|
|
Page * cacheStalePage();
|
|
|
|
|
|
|
|
#define INITIAL 0
|
|
|
|
#define FULL 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern int cache_state;
|
2004-06-30 01:09:57 +00:00
|
|
|
|
|
|
|
#endif
|