public class CacheManagerWithShadowCache extends Object implements CacheManager
Modifier and Type | Class and Description |
---|---|
static class |
CacheManagerWithShadowCache.PageIdFunnel
Funnel for PageId.
|
CacheManager.Factory, CacheManager.State
LOG
Constructor and Description |
---|
CacheManagerWithShadowCache(CacheManager cacheManager,
AlluxioConfiguration conf) |
Modifier and Type | Method and Description |
---|---|
void |
aging()
Decrease each item's clock and clean stale items.
|
boolean |
append(PageId pageId,
int appendAt,
byte[] page,
CacheContext cacheContext) |
void |
close() |
void |
commitFile(String fileId)
Commit the File.
|
boolean |
delete(PageId pageId)
Deletes a page from the cache.
|
void |
deleteFile(String fileId)
Deletes all pages of the given file.
|
void |
deleteTempFile(String fileId)
Deletes all temporary pages of the given file.
|
int |
get(PageId pageId,
int pageOffset,
int bytesToRead,
ReadTargetBuffer target,
CacheContext cacheContext)
Reads a part of a page if the queried page is found in the cache, stores the result in buffer.
|
int |
getAndLoad(PageId pageId,
int pageOffset,
int bytesToRead,
ReadTargetBuffer buffer,
CacheContext cacheContext,
java.util.function.Supplier<byte[]> externalDataSupplier)
Reads a part of a page if the queried page is found in the cache, stores the result in buffer.
|
Optional<DataFileChannel> |
getDataFileChannel(PageId pageId,
int pageOffset,
int bytesToRead,
CacheContext cacheContext)
Get a
DataFileChannel which wraps a FileRegion . |
long |
getShadowCacheByteHit() |
long |
getShadowCacheByteRead() |
long |
getShadowCacheBytes() |
long |
getShadowCachePageHit() |
long |
getShadowCachePageRead() |
long |
getShadowCachePages() |
Optional<CacheUsage> |
getUsage()
Gets cache usage.
|
boolean |
put(PageId pageId,
ByteBuffer page,
CacheContext cacheContext)
Puts a page into the cache manager with scope and quota respected.
|
CacheManager.State |
state() |
void |
stopUpdate()
Stop to switch bloom filters and update working set size.
|
void |
updateWorkingSetSize()
Update working set size in number of pages and bytes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, get, get, get, getCachedPageIdsByFileId, invalidate, put, put, put
public CacheManagerWithShadowCache(CacheManager cacheManager, AlluxioConfiguration conf)
cacheManager
- the real cache managerconf
- the alluxio configurationpublic void commitFile(String fileId)
CacheManager
commitFile
in interface CacheManager
fileId
- the file IDpublic boolean put(PageId pageId, ByteBuffer page, CacheContext cacheContext)
CacheManager
put
in interface CacheManager
pageId
- page identifierpage
- page datacacheContext
- cache related contextpublic int get(PageId pageId, int pageOffset, int bytesToRead, ReadTargetBuffer target, CacheContext cacheContext)
CacheManager
get
in interface CacheManager
pageId
- page identifierpageOffset
- offset into the pagebytesToRead
- number of bytes to read in this pagetarget
- destination buffer to writecacheContext
- cache related contextpublic int getAndLoad(PageId pageId, int pageOffset, int bytesToRead, ReadTargetBuffer buffer, CacheContext cacheContext, java.util.function.Supplier<byte[]> externalDataSupplier)
CacheManager
getAndLoad
in interface CacheManager
pageId
- page identifierpageOffset
- offset into the pagebytesToRead
- number of bytes to read in this pagebuffer
- destination buffer to writecacheContext
- cache related contextexternalDataSupplier
- the external data supplier to read a pagepublic void updateWorkingSetSize()
public boolean delete(PageId pageId)
CacheManager
delete
in interface CacheManager
pageId
- page identifierpublic void stopUpdate()
public CacheManager.State state()
state
in interface CacheManager
public boolean append(PageId pageId, int appendAt, byte[] page, CacheContext cacheContext)
append
in interface CacheManager
public void close() throws Exception
close
in interface AutoCloseable
Exception
public void deleteFile(String fileId)
CacheManager
deleteFile
in interface CacheManager
fileId
- the file id of the target filepublic void deleteTempFile(String fileId)
CacheManager
deleteTempFile
in interface CacheManager
fileId
- the file id of the target filepublic Optional<CacheUsage> getUsage()
CacheStatus
getUsage
in interface CacheManager
getUsage
in interface CacheStatus
public Optional<DataFileChannel> getDataFileChannel(PageId pageId, int pageOffset, int bytesToRead, CacheContext cacheContext) throws PageNotFoundException
CacheManager
DataFileChannel
which wraps a FileRegion
.getDataFileChannel
in interface CacheManager
pageId
- the page idpageOffset
- the offset inside the pagebytesToRead
- the bytes to readcacheContext
- the cache contextDataFileChannel
PageNotFoundException
public void aging()
public long getShadowCachePages()
public long getShadowCacheBytes()
public long getShadowCachePageRead()
public long getShadowCachePageHit()
public long getShadowCacheByteRead()
public long getShadowCacheByteHit()
Copyright © 2023. All Rights Reserved.