public class PagedBlockStoreDir extends Object implements PageStoreDir
Modifier and Type | Field and Description |
---|---|
protected com.google.common.collect.HashMultimap<Long,PageInfo> |
mBlockToPagesMap |
protected PageStoreDir |
mDelegate |
protected BlockPageEvictor |
mEvictor |
protected int |
mIndex |
protected BlockStoreLocation |
mLocation |
protected com.google.common.collect.HashMultimap<Long,PageInfo> |
mTempBlockToPagesMap |
LOG
Constructor and Description |
---|
PagedBlockStoreDir(PageStoreDir delegate,
int index)
Creates a new dir.
|
Modifier and Type | Method and Description |
---|---|
void |
abort(String fileId)
Abort a temporary file.
|
void |
close()
Close the page store dir.
|
void |
commit(String fileId,
String newFileId)
Commit a temporary file with a new file ID.
|
long |
deletePage(PageInfo pageInfo) |
static List<PagedBlockStoreDir> |
fromPageStoreDirs(List<PageStoreDir> dirs)
Creates from a list of
PageStoreDir . |
long |
getBlockCachedBytes(long blockId)
Gets how many bytes of a block is being cached by this dir.
|
int |
getBlockCachedPages(long blockId)
Gets how many pages of a block is being cached by this dir.
|
Set<PageId> |
getBlockPages(long blockId)
Gets pages in this block.
|
long |
getCachedBytes() |
long |
getCapacityBytes() |
int |
getDirIndex() |
BlockPageEvictor |
getEvictor() |
BlockStoreLocation |
getLocation() |
int |
getNumBlocks() |
PageStore |
getPageStore() |
Path |
getRootPath() |
long |
getTempBlockCachedBytes(long blockId)
Gets how many bytes of a temp block is being cached by this dir.
|
boolean |
hasFile(String fileId) |
boolean |
hasTempFile(String fileId) |
void |
putPage(PageInfo pageInfo) |
boolean |
putTempFile(String fileId) |
void |
putTempPage(PageInfo pageInfo) |
long |
release(long bytes)
Release the pre-reserved space.
|
boolean |
reserve(long bytes) |
void |
reset()
Reset page store.
|
void |
scanPages(java.util.function.Consumer<Optional<PageInfo>> pageInfoConsumer)
Scan the pages under this dir.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, commit, createPageStoreDir, createPageStoreDirs, getFileBucket
protected final PageStoreDir mDelegate
protected final int mIndex
protected final com.google.common.collect.HashMultimap<Long,PageInfo> mBlockToPagesMap
protected final com.google.common.collect.HashMultimap<Long,PageInfo> mTempBlockToPagesMap
protected final BlockStoreLocation mLocation
protected final BlockPageEvictor mEvictor
public PagedBlockStoreDir(PageStoreDir delegate, int index)
delegate
- the page store dir that is delegated toindex
- the index of this dir in the tierpublic static List<PagedBlockStoreDir> fromPageStoreDirs(List<PageStoreDir> dirs)
PageStoreDir
.dirs
- dirsPagedBlockStoreDir
public Path getRootPath()
getRootPath
in interface PageStoreDir
public PageStore getPageStore()
getPageStore
in interface PageStoreDir
public int getDirIndex()
public BlockStoreLocation getLocation()
public int getNumBlocks()
public long getCapacityBytes()
getCapacityBytes
in interface PageStoreDir
public void reset() throws IOException
PageStoreDir
reset
in interface PageStoreDir
IOException
public void scanPages(java.util.function.Consumer<Optional<PageInfo>> pageInfoConsumer) throws IOException
PageStoreDir
scanPages
in interface PageStoreDir
IOException
public long getCachedBytes()
getCachedBytes
in interface PageStoreDir
public void putPage(PageInfo pageInfo)
putPage
in interface PageStoreDir
public void putTempPage(PageInfo pageInfo)
putTempPage
in interface PageStoreDir
public boolean putTempFile(String fileId)
putTempFile
in interface PageStoreDir
fileId
- file idpublic boolean reserve(long bytes)
reserve
in interface PageStoreDir
public long deletePage(PageInfo pageInfo)
deletePage
in interface PageStoreDir
public long release(long bytes)
PageStoreDir
release
in interface PageStoreDir
public boolean hasFile(String fileId)
hasFile
in interface PageStoreDir
public boolean hasTempFile(String fileId)
hasTempFile
in interface PageStoreDir
public BlockPageEvictor getEvictor()
getEvictor
in interface PageStoreDir
public void close()
PageStoreDir
close
in interface PageStoreDir
public void commit(String fileId, String newFileId) throws IOException
PageStoreDir
commit
in interface PageStoreDir
IOException
public void abort(String fileId) throws IOException
PageStoreDir
abort
in interface PageStoreDir
IOException
public long getBlockCachedBytes(long blockId)
blockId
- the block idpublic long getTempBlockCachedBytes(long blockId)
blockId
- the block idpublic int getBlockCachedPages(long blockId)
blockId
- the block idCopyright © 2023. All Rights Reserved.