public class LocalPageStoreDir extends Object
Constructor and Description |
---|
LocalPageStoreDir(PageStoreOptions pageStoreOptions,
PageStore pageStore,
CacheEvictor evictor)
Constructor for LocalCacheDir.
|
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) |
void |
deleteTempPage(PageInfo pageInfo) |
long |
getCachedBytes() |
long |
getCapacityBytes() |
CacheEvictor |
getEvictor() |
PageStore |
getPageStore()
Getter for pageStore.
|
Path |
getRootPath() |
Optional<CacheUsage> |
getUsage()
Gets cache usage.
|
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)
Gets a stream of all pages from the page store.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, commit, createPageStoreDir, createPageStoreDirs, getFileBucket
public LocalPageStoreDir(PageStoreOptions pageStoreOptions, PageStore pageStore, CacheEvictor evictor)
pageStoreOptions
- pageStore
- evictor
- public PageStore getPageStore()
public void reset() throws IOException
IOException
public void scanPages(java.util.function.Consumer<Optional<PageInfo>> pageInfoConsumer) throws IOException
IOException
- if any error occurspublic Optional<CacheUsage> getUsage()
CacheStatus
public Path getRootPath()
getRootPath
in interface PageStoreDir
public long getCapacityBytes()
getCapacityBytes
in interface PageStoreDir
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 long deletePage(PageInfo pageInfo)
deletePage
in interface PageStoreDir
public void deleteTempPage(PageInfo pageInfo)
deleteTempPage
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 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 CacheEvictor 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
Copyright © 2023. All Rights Reserved.