public interface PageMetaStore extends CacheStatus
Modifier and Type | Method and Description |
---|---|
void |
addPage(PageId pageId,
PageInfo pageInfo)
Adds a new page to the cache.
|
void |
addTempPage(PageId pageId,
PageInfo pageInfo)
Adds a new temp page to the cache.
|
PageStoreDir |
allocate(String fileId,
long fileLength) |
long |
bytes() |
void |
commitFile(String fileId,
String newFileId)
Commits a temp file so that all its pages become permanent.
|
static PageMetaStore |
create(CacheManagerOptions options) |
PageInfo |
evict(CacheScope cacheScope,
PageStoreDir pageStoreDir) |
default PageInfo |
evict(PageStoreDir pageStoreDir) |
Set<PageInfo> |
getAllPagesByFileId(String fileId)
Gets all pages by the specified File ID.
|
ReadWriteLock |
getLock() |
PageInfo |
getPageInfo(PageId pageId) |
PageStoreDir |
getStoreDirOfFile(String fileId)
Gets the store dir which the specified file is assigned to be cached in.
|
List<PageStoreDir> |
getStoreDirs()
Gets the storage directories.
|
boolean |
hasPage(PageId pageId) |
long |
numPages() |
PageInfo |
removePage(PageId pageId)
Removes a page.
|
PageInfo |
removePage(PageId pageId,
boolean isTemporary)
Removes a page.
|
void |
reset()
Resets the meta store.
|
getUsage
static PageMetaStore create(CacheManagerOptions options) throws IOException
options
- the options of cacheIOException
ReadWriteLock getLock()
boolean hasPage(PageId pageId)
pageId
- page identifiervoid addPage(PageId pageId, PageInfo pageInfo)
pageId
- page identifierpageInfo
- info of the pagevoid addTempPage(PageId pageId, PageInfo pageInfo)
pageId
- page identifierpageInfo
- info of the pagevoid commitFile(String fileId, String newFileId) throws PageNotFoundException
fileId
- the temp file to commitnewFileId
- the new file name of the file after committingPageNotFoundException
PageStoreDir getStoreDirOfFile(String fileId) throws FileDoesNotExistException
fileId
- the file IDFileDoesNotExistException
- if the file is not being cachedList<PageStoreDir> getStoreDirs()
PageStoreDir allocate(String fileId, long fileLength)
fileId
- fileLength
- PageInfo getPageInfo(PageId pageId) throws PageNotFoundException
pageId
- page identifierPageNotFoundException
PageInfo removePage(PageId pageId, boolean isTemporary) throws PageNotFoundException
pageId
- page identifierisTemporary
- whether is it temporary page or notPageNotFoundException
PageInfo removePage(PageId pageId) throws PageNotFoundException
pageId
- page identifierPageNotFoundException
long bytes()
long numPages()
void reset()
Set<PageInfo> getAllPagesByFileId(String fileId)
fileId
- the target file iddefault PageInfo evict(PageStoreDir pageStoreDir)
pageStoreDir
- PageInfo evict(CacheScope cacheScope, PageStoreDir pageStoreDir)
cacheScope
- pageStoreDir
- Copyright © 2023. All Rights Reserved.