Package org.apache.bookkeeper.bookie
Class LedgerCacheImpl
java.lang.Object
org.apache.bookkeeper.bookie.LedgerCacheImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,LedgerCache
Implementation of LedgerCache interface.
This class serves two purposes.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.bookkeeper.bookie.LedgerCache
LedgerCache.LedgerIndexMetadata, LedgerCache.NoIndexForLedgerException, LedgerCache.PageEntries, LedgerCache.PageEntriesIterable -
Constructor Summary
ConstructorsConstructorDescriptionLedgerCacheImpl(ServerConfiguration conf, SnapshotMap<Long, Boolean> activeLedgers, LedgerDirsManager ledgerDirsManager) LedgerCacheImpl(ServerConfiguration conf, SnapshotMap<Long, Boolean> activeLedgers, LedgerDirsManager ledgerDirsManager, StatsLogger statsLogger) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelWaitForLastAddConfirmedUpdate(long ledgerId, Watcher<LastAddConfirmedUpdateNotification> watcher) voidclose()voiddeleteLedger(long ledgerId) This method is called whenever a ledger is deleted by the BookKeeper Client and we want to remove all relevant data for it stored in the LedgerCache.voidflushLedger(boolean doAll) getEntriesIterator(long ledgerId) longgetEntryOffset(long ledger, long entry) io.netty.buffer.ByteBufgetExplicitLac(long ledgerId) (package private) IndexInMemPageMgr(package private) IndexPersistenceMgrgetLastAddConfirmed(long ledgerId) longgetLastEntry(long ledgerId) intbooleanisFenced(long ledgerId) booleanledgerExists(long ledgerId) listEntries(long ledgerId) voidputEntryOffset(long ledger, long entry, long offset) readLedgerIndexMetadata(long ledgerId) byte[]readMasterKey(long ledgerId) voidsetExplicitLac(long ledgerId, io.netty.buffer.ByteBuf lac) booleansetFenced(long ledgerId) voidsetMasterKey(long ledgerId, byte[] masterKey) longupdateLastAddConfirmed(long ledgerId, long lac) booleanwaitForLastAddConfirmedUpdate(long ledgerId, long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher)
-
Constructor Details
-
LedgerCacheImpl
public LedgerCacheImpl(ServerConfiguration conf, SnapshotMap<Long, Boolean> activeLedgers, LedgerDirsManager ledgerDirsManager) throws IOException- Throws:
IOException
-
LedgerCacheImpl
public LedgerCacheImpl(ServerConfiguration conf, SnapshotMap<Long, Boolean> activeLedgers, LedgerDirsManager ledgerDirsManager, StatsLogger statsLogger) throws IOException- Throws:
IOException
-
-
Method Details
-
getIndexPersistenceManager
IndexPersistenceMgr getIndexPersistenceManager() -
getIndexPageManager
IndexInMemPageMgr getIndexPageManager() -
getPageSize
public int getPageSize()- Returns:
- page size used in ledger cache
-
getLastAddConfirmed
- Specified by:
getLastAddConfirmedin interfaceLedgerCache- Throws:
IOException
-
updateLastAddConfirmed
- Specified by:
updateLastAddConfirmedin interfaceLedgerCache- Throws:
IOException
-
waitForLastAddConfirmedUpdate
public boolean waitForLastAddConfirmedUpdate(long ledgerId, long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher) throws IOException - Specified by:
waitForLastAddConfirmedUpdatein interfaceLedgerCache- Throws:
IOException
-
cancelWaitForLastAddConfirmedUpdate
public void cancelWaitForLastAddConfirmedUpdate(long ledgerId, Watcher<LastAddConfirmedUpdateNotification> watcher) throws IOException - Specified by:
cancelWaitForLastAddConfirmedUpdatein interfaceLedgerCache- Throws:
IOException
-
putEntryOffset
- Specified by:
putEntryOffsetin interfaceLedgerCache- Throws:
IOException
-
getEntryOffset
- Specified by:
getEntryOffsetin interfaceLedgerCache- Throws:
IOException
-
flushLedger
- Specified by:
flushLedgerin interfaceLedgerCache- Throws:
IOException
-
getLastEntry
- Specified by:
getLastEntryin interfaceLedgerCache- Throws:
IOException
-
deleteLedger
This method is called whenever a ledger is deleted by the BookKeeper Client and we want to remove all relevant data for it stored in the LedgerCache.- Specified by:
deleteLedgerin interfaceLedgerCache- Throws:
IOException
-
readMasterKey
- Specified by:
readMasterKeyin interfaceLedgerCache- Throws:
IOExceptionBookieException
-
setFenced
- Specified by:
setFencedin interfaceLedgerCache- Throws:
IOException
-
isFenced
- Specified by:
isFencedin interfaceLedgerCache- Throws:
IOException
-
setExplicitLac
- Specified by:
setExplicitLacin interfaceLedgerCache- Throws:
IOException
-
getExplicitLac
public io.netty.buffer.ByteBuf getExplicitLac(long ledgerId) - Specified by:
getExplicitLacin interfaceLedgerCache
-
setMasterKey
- Specified by:
setMasterKeyin interfaceLedgerCache- Throws:
IOException
-
ledgerExists
- Specified by:
ledgerExistsin interfaceLedgerCache- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
listEntries
- Specified by:
listEntriesin interfaceLedgerCache- Throws:
IOException
-
readLedgerIndexMetadata
- Specified by:
readLedgerIndexMetadatain interfaceLedgerCache- Throws:
IOException
-
getEntriesIterator
- Specified by:
getEntriesIteratorin interfaceLedgerCache- Throws:
IOException
-