@NotThreadSafe public class DefaultPageMetaStore extends java.lang.Object implements PageMetaStore
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.locks.ReentrantReadWriteLock |
mLock |
| Constructor and Description |
|---|
DefaultPageMetaStore(java.util.List<PageStoreDir> dirs) |
DefaultPageMetaStore(java.util.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(java.lang.String fileId,
long fileLength) |
long |
bytes() |
void |
commitFile(java.lang.String fileId,
java.lang.String newFileId)
Commits a temp file so that all its pages become permanent.
|
PageInfo |
evict(CacheScope scope,
PageStoreDir pageStoreDir) |
java.util.concurrent.locks.ReentrantReadWriteLock |
getLock() |
PageInfo |
getPageInfo(PageId pageId) |
java.util.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, waitcreate, evictpublic DefaultPageMetaStore(java.util.List<PageStoreDir> dirs)
dirs - storage directoriespublic DefaultPageMetaStore(java.util.List<PageStoreDir> dirs, Allocator allocator)
dirs - storage directoriesallocator - storage allocatorpublic java.util.concurrent.locks.ReentrantReadWriteLock getLock()
getLock in interface PageMetaStorepublic boolean hasPage(PageId pageId)
hasPage in interface PageMetaStorepageId - page identifierpublic void addPage(PageId pageId, PageInfo pageInfo)
PageMetaStoreaddPage in interface PageMetaStorepageId - page identifierpageInfo - info of the pagepublic void addTempPage(PageId pageId, PageInfo pageInfo)
PageMetaStoreaddTempPage in interface PageMetaStorepageId - page identifierpageInfo - info of the pagepublic void commitFile(java.lang.String fileId,
java.lang.String newFileId)
throws PageNotFoundException
PageMetaStorecommitFile in interface PageMetaStorefileId - the temp file to commitnewFileId - the new file name of the file after committingPageNotFoundExceptionpublic java.util.List<PageStoreDir> getStoreDirs()
PageMetaStoregetStoreDirs in interface PageMetaStorepublic PageStoreDir allocate(java.lang.String fileId, long fileLength)
allocate in interface PageMetaStorepublic PageInfo getPageInfo(PageId pageId) throws PageNotFoundException
getPageInfo in interface PageMetaStorepageId - page identifierPageNotFoundExceptionpublic PageInfo removePage(PageId pageId) throws PageNotFoundException
PageMetaStoreremovePage in interface PageMetaStorepageId - page identifierPageNotFoundExceptionpublic long bytes()
bytes in interface PageMetaStorepublic long numPages()
numPages in interface PageMetaStorepublic void reset()
PageMetaStorereset in interface PageMetaStore@Nullable public PageInfo evict(CacheScope scope, PageStoreDir pageStoreDir)
evict in interface PageMetaStoreCopyright © 2022. All Rights Reserved.