@NotThreadSafe public class DefaultPageMetaStore extends Object implements PageMetaStore
Modifier and Type | Field and Description |
---|---|
protected ReentrantReadWriteLock |
mLock |
Constructor and Description |
---|
DefaultPageMetaStore(List<PageStoreDir> dirs)
Constructor of DefaultMetaStore.
|
DefaultPageMetaStore(List<PageStoreDir> dirs,
ReentrantReadWriteLock lock)
Creates a new instance with a shared lock.
|
Modifier and Type | Method and Description |
---|---|
void |
addPage(PageId pageId,
PageInfo pageInfo)
Adds a new page to the cache.
|
long |
bytes() |
PageInfo |
evict(CacheScope scope,
PageStoreDir pageStoreDir) |
ReentrantReadWriteLock |
getLock() |
PageInfo |
getPageInfo(PageId pageId) |
Iterator<PageId> |
getPagesIterator()
Gets an iterator over the pages currently stored in this metastore.
|
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, ReentrantReadWriteLock lock)
dirs
- storage directorieslock
- the lock to associate with this meta storepublic 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 Iterator<PageId> getPagesIterator()
PageMetaStore
getPagesIterator
in interface PageMetaStore
public List<PageStoreDir> getStoreDirs()
PageMetaStore
getStoreDirs
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.