public class PagedBlockMetaStore extends Object implements PageMetaStore
Constructor and Description |
---|
PagedBlockMetaStore(List<PagedBlockStoreDir> dirs) |
PagedBlockMetaStore(List<PagedBlockStoreDir> dirs,
Allocator allocator) |
Modifier and Type | Method and Description |
---|---|
void |
addBlock(PagedBlockMeta blockMeta) |
void |
addPage(PageId pageId,
PageInfo pageInfo)
Adds a new page to the cache.
|
void |
addTempBlock(PagedTempBlockMeta blockMeta)
Adds a temp block for writing.
|
void |
addTempPage(PageId pageId,
PageInfo pageInfo)
Adds a new temp page to the cache.
|
PageStoreDir |
allocate(String fileId,
long pageSize)
Allocates a page store directory for a page of a block.
|
long |
bytes() |
PagedBlockMeta |
commit(long blockId) |
void |
commitFile(String fileId,
String newFileId)
Commits a temp file so that all its pages become permanent.
|
PageInfo |
evict(CacheScope cacheScope,
PageStoreDir pageStoreDir) |
ReadWriteLock |
getLock() |
PageInfo |
getPageInfo(PageId pageId) |
List<PageStoreDir> |
getStoreDirs()
Gets the storage directories.
|
PagedBlockStoreMeta |
getStoreMeta() |
PagedBlockStoreMeta |
getStoreMetaFull() |
boolean |
hasBlock(long blockId)
Checks if at least one page of a block is currently being stored in the cache.
|
boolean |
hasFullBlock(long blockId)
Checks if the block is fully cached in the block store.
|
boolean |
hasPage(PageId pageId) |
boolean |
hasTempBlock(long blockId) |
long |
numPages() |
void |
registerBlockStoreEventListener(BlockStoreEventListener listener) |
PageInfo |
removePage(PageId pageId)
Removes a page.
|
void |
reset()
Resets the meta store.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create, evict
public PagedBlockMetaStore(List<PagedBlockStoreDir> dirs)
dirs
- the storage dirspublic PagedBlockMetaStore(List<PagedBlockStoreDir> dirs, Allocator allocator)
dirs
- dirsallocator
- allocatorpublic boolean hasBlock(long blockId)
blockId
- block IDpublic boolean hasTempBlock(long blockId)
blockId
- public boolean hasFullBlock(long blockId)
blockId
- block IDpublic PageStoreDir allocate(String fileId, long pageSize)
allocate
in interface PageMetaStore
fileId
- the block IDpageSize
- size of the pagepublic PageInfo getPageInfo(PageId pageId) throws PageNotFoundException
getPageInfo
in interface PageMetaStore
pageId
- page identifierPageNotFoundException
public ReadWriteLock getLock()
getLock
in interface PageMetaStore
public boolean hasPage(PageId pageId)
hasPage
in interface PageMetaStore
pageId
- page identifierpublic void addPage(PageId pageId, PageInfo pageInfo)
PageMetaStore
addPage
in interface PageMetaStore
pageId
- page identifierpageInfo
- info of the pagepublic void addTempPage(PageId pageId, PageInfo pageInfo)
PageMetaStore
addTempPage
in interface PageMetaStore
pageId
- page identifierpageInfo
- info of the pagepublic void commitFile(String fileId, String newFileId) throws PageNotFoundException
PageMetaStore
commitFile
in interface PageMetaStore
fileId
- the temp file to commitnewFileId
- the new file name of the file after committingPageNotFoundException
public PagedBlockMeta commit(long blockId)
blockId
- public List<PageStoreDir> getStoreDirs()
PageMetaStore
getStoreDirs
in interface PageMetaStore
public PageInfo removePage(PageId pageId) throws PageNotFoundException
PageMetaStore
removePage
in interface PageMetaStore
pageId
- page identifierPageNotFoundException
public long bytes()
bytes
in interface PageMetaStore
public long numPages()
numPages
in interface PageMetaStore
public void reset()
PageMetaStore
reset
in interface PageMetaStore
public PageInfo evict(CacheScope cacheScope, PageStoreDir pageStoreDir)
evict
in interface PageMetaStore
public void addBlock(PagedBlockMeta blockMeta)
blockMeta
- public void addTempBlock(PagedTempBlockMeta blockMeta)
blockMeta
- the temp block to addpublic void registerBlockStoreEventListener(BlockStoreEventListener listener)
listener
- listenerpublic PagedBlockStoreMeta getStoreMeta()
public PagedBlockStoreMeta getStoreMetaFull()
Copyright © 2023. All Rights Reserved.