public interface PageStoreDir extends CacheStatus
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Modifier and Type | Method and Description |
---|---|
void |
abort(String fileId)
Abort a temporary file.
|
static void |
clear(Path rootPath)
Clear the dir.
|
void |
close()
Close the page store dir.
|
default void |
commit(String fileId)
Commit a temporary file.
|
void |
commit(String fileId,
String newFileId)
Commit a temporary file with a new file ID.
|
static PageStoreDir |
createPageStoreDir(CacheEvictorOptions cacheEvictorOptions,
PageStoreOptions pageStoreOptions)
Create an instance of PageStoreDir.
|
static List<PageStoreDir> |
createPageStoreDirs(CacheManagerOptions options)
Create a list of PageStoreDir based on the configuration.
|
long |
deletePage(PageInfo bytes) |
void |
deleteTempPage(PageInfo bytes) |
long |
getCachedBytes() |
long |
getCapacityBytes() |
CacheEvictor |
getEvictor() |
static String |
getFileBucket(int fileBuckets,
String fileId) |
PageStore |
getPageStore() |
Path |
getRootPath() |
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.
|
getUsage
static List<PageStoreDir> createPageStoreDirs(CacheManagerOptions options) throws IOException
options
- of cache managerIOException
static PageStoreDir createPageStoreDir(CacheEvictorOptions cacheEvictorOptions, PageStoreOptions pageStoreOptions)
cacheEvictorOptions
- pageStoreOptions
- static String getFileBucket(int fileBuckets, String fileId)
fileBuckets
- number of bucketsfileId
- file idstatic void clear(Path rootPath) throws IOException
rootPath
- IOException
- when failed to clean up the specific locationPath getRootPath()
PageStore getPageStore()
long getCapacityBytes()
void reset() throws IOException
IOException
void scanPages(java.util.function.Consumer<Optional<PageInfo>> pageInfoConsumer) throws IOException
pageInfoConsumer
- IOException
long getCachedBytes()
void putPage(PageInfo pageInfo)
pageInfo
- void putTempPage(PageInfo pageInfo)
pageInfo
- boolean putTempFile(String fileId)
fileId
- file idboolean reserve(long bytes)
bytes
- void deleteTempPage(PageInfo bytes)
bytes
- long deletePage(PageInfo bytes)
bytes
- long release(long bytes)
bytes
- boolean hasFile(String fileId)
fileId
- boolean hasTempFile(String fileId)
fileId
- CacheEvictor getEvictor()
void close()
default void commit(String fileId) throws IOException
fileId
- IOException
void commit(String fileId, String newFileId) throws IOException
fileId
- newFileId
- IOException
void abort(String fileId) throws IOException
fileId
- IOException
Copyright © 2023. All Rights Reserved.