@NotThreadSafe public class DefaultPageMetaStore extends Object implements PageMetaStore
Modifier and Type | Field and Description |
---|---|
protected ReentrantReadWriteLock |
mLock |
Constructor and Description |
---|
DefaultPageMetaStore(List<PageStoreDir> dirs) |
DefaultPageMetaStore(List<PageStoreDir> dirs,
Allocator allocator)
Constructor of DefaultMetaStore.
|
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.
|
PageInfo |
evict(CacheScope scope,
PageStoreDir pageStoreDir) |
ReentrantReadWriteLock |
getLock() |
PageInfo |
getPageInfo(PageId pageId) |
List<PageStoreDir> |
getStoreDirs()
Gets the storage directories.
|
boolean |
hasPage(PageId pageId) |
long |
numPages() |
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
protected final ReentrantReadWriteLock mLock
public DefaultPageMetaStore(List<PageStoreDir> dirs)
dirs
- storage directoriespublic DefaultPageMetaStore(List<PageStoreDir> dirs, Allocator allocator)
dirs
- storage directoriesallocator
- storage allocatorpublic ReentrantReadWriteLock 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 List<PageStoreDir> getStoreDirs()
PageMetaStore
getStoreDirs
in interface PageMetaStore
public PageStoreDir allocate(String fileId, long fileLength)
allocate
in interface PageMetaStore
public PageInfo getPageInfo(PageId pageId) throws PageNotFoundException
getPageInfo
in interface PageMetaStore
pageId
- page identifierPageNotFoundException
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
@Nullable public PageInfo evict(CacheScope scope, PageStoreDir pageStoreDir)
evict
in interface PageMetaStore
Copyright © 2023. All Rights Reserved.