public class EntryCacheImpl extends Object implements EntryCache
| Modifier and Type | Field and Description |
|---|---|
static io.netty.buffer.PooledByteBufAllocator |
ALLOCATOR |
| Constructor and Description |
|---|
EntryCacheImpl(EntryCacheManager manager,
ManagedLedgerImpl ml,
boolean copyEntries) |
| Modifier and Type | Method and Description |
|---|---|
void |
asyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle lh,
long firstEntry,
long lastEntry,
boolean isSlowestReader,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx)
Read entries from the cache or from bookkeeper.
|
void |
asyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle lh,
PositionImpl position,
AsyncCallbacks.ReadEntryCallback callback,
Object ctx)
Read entry at given position from the cache or from bookkeeper.
|
void |
clear()
Remove all the entries from the cache.
|
int |
compareTo(EntryCache other) |
org.apache.commons.lang3.tuple.Pair<Integer,Long> |
evictEntries(long sizeToFree)
Force the cache to drop entries to free space.
|
String |
getName() |
long |
getSize()
Get the total size in bytes of all the entries stored in this cache.
|
boolean |
insert(EntryImpl entry)
Insert an entry in the cache.
|
void |
invalidateAllEntries(long ledgerId)
Remove from the cache all the entries belonging to a specific ledger.
|
void |
invalidateEntries(PositionImpl lastPosition)
Remove from cache all the entries related to a ledger up to lastPosition included.
|
void |
invalidateEntriesBeforeTimestamp(long timestamp) |
public EntryCacheImpl(EntryCacheManager manager, ManagedLedgerImpl ml, boolean copyEntries)
public String getName()
getName in interface EntryCachepublic boolean insert(EntryImpl entry)
EntryCacheinsert in interface EntryCacheentry - the entry to be cachedpublic void invalidateEntries(PositionImpl lastPosition)
EntryCacheinvalidateEntries in interface EntryCachelastPosition - the position of the last entry to be invalidated (non-inclusive)public void invalidateAllEntries(long ledgerId)
EntryCacheinvalidateAllEntries in interface EntryCacheledgerId - the ledger idpublic void asyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle lh, PositionImpl position, AsyncCallbacks.ReadEntryCallback callback, Object ctx)
EntryCacheasyncReadEntry in interface EntryCachelh - the ledger handleposition - position to read the entry fromcallback - the callback object that will be notified when read is donectx - the context objectpublic void asyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle lh, long firstEntry, long lastEntry, boolean isSlowestReader, AsyncCallbacks.ReadEntriesCallback callback, Object ctx)
EntryCacheasyncReadEntry in interface EntryCachelh - the ledger handlefirstEntry - the first entry to read (inclusive)lastEntry - the last entry to read (inclusive)isSlowestReader - whether the reader cursor is the most far behind in the streamcallback - the callback object that will be notified when read is donectx - the context objectpublic void clear()
EntryCacheclear in interface EntryCachepublic long getSize()
EntryCachegetSize in interface EntryCachepublic int compareTo(EntryCache other)
compareTo in interface Comparable<EntryCache>public org.apache.commons.lang3.tuple.Pair<Integer,Long> evictEntries(long sizeToFree)
EntryCacheevictEntries in interface EntryCachesizeToFree - the total memory size to freepublic void invalidateEntriesBeforeTimestamp(long timestamp)
invalidateEntriesBeforeTimestamp in interface EntryCacheCopyright © 2017–2021 Apache Software Foundation. All rights reserved.