Package org.apache.bookkeeper.bookie
Interface LedgerCache
- 
- All Superinterfaces:
 java.lang.AutoCloseable,java.io.Closeable
- All Known Implementing Classes:
 InterleavedStorageRegenerateIndexOp.DryRunLedgerCache,LedgerCacheImpl
public interface LedgerCache extends java.io.CloseableThis class maps a ledger entry number into a location (entrylogid, offset) in an entry log file. It does user level caching to more efficiently manage disk head scheduling. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classLedgerCache.LedgerIndexMetadataRepresents summary of ledger metadata.static classLedgerCache.NoIndexForLedgerExceptionSpecific exception to encode the case where the index is not present.static interfaceLedgerCache.PageEntriesRepresents a page of the index.static interfaceLedgerCache.PageEntriesIterableIterable over index pages -- returns PageEntries rather than individual entries because getEntries() above needs to be able to throw an IOException. 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancelWaitForLastAddConfirmedUpdate(long ledgerId, Watcher<LastAddConfirmedUpdateNotification> watcher)voiddeleteLedger(long ledgerId)voidflushLedger(boolean doAll)java.util.PrimitiveIterator.OfLonggetEntriesIterator(long ledgerId)longgetEntryOffset(long ledger, long entry)io.netty.buffer.ByteBufgetExplicitLac(long ledgerId)java.lang.LonggetLastAddConfirmed(long ledgerId)longgetLastEntry(long ledgerId)booleanisFenced(long ledgerId)booleanledgerExists(long ledgerId)LedgerCache.PageEntriesIterablelistEntries(long ledgerId)voidputEntryOffset(long ledger, long entry, long offset)LedgerCache.LedgerIndexMetadatareadLedgerIndexMetadata(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) 
 - 
 
- 
- 
Method Detail
- 
setFenced
boolean setFenced(long ledgerId) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
isFenced
boolean isFenced(long ledgerId) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
setMasterKey
void setMasterKey(long ledgerId, byte[] masterKey) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
readMasterKey
byte[] readMasterKey(long ledgerId) throws java.io.IOException, BookieException- Throws:
 java.io.IOExceptionBookieException
 
- 
ledgerExists
boolean ledgerExists(long ledgerId) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
putEntryOffset
void putEntryOffset(long ledger, long entry, long offset) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
getEntryOffset
long getEntryOffset(long ledger, long entry) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
flushLedger
void flushLedger(boolean doAll) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
getLastEntry
long getLastEntry(long ledgerId) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
getLastAddConfirmed
java.lang.Long getLastAddConfirmed(long ledgerId) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
updateLastAddConfirmed
long updateLastAddConfirmed(long ledgerId, long lac) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
waitForLastAddConfirmedUpdate
boolean waitForLastAddConfirmedUpdate(long ledgerId, long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
cancelWaitForLastAddConfirmedUpdate
void cancelWaitForLastAddConfirmedUpdate(long ledgerId, Watcher<LastAddConfirmedUpdateNotification> watcher) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
deleteLedger
void deleteLedger(long ledgerId) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
setExplicitLac
void setExplicitLac(long ledgerId, io.netty.buffer.ByteBuf lac) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
getExplicitLac
io.netty.buffer.ByteBuf getExplicitLac(long ledgerId)
 
- 
listEntries
LedgerCache.PageEntriesIterable listEntries(long ledgerId) throws java.io.IOException
- Throws:
 java.io.IOException
 
- 
getEntriesIterator
java.util.PrimitiveIterator.OfLong getEntriesIterator(long ledgerId) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
readLedgerIndexMetadata
LedgerCache.LedgerIndexMetadata readLedgerIndexMetadata(long ledgerId) throws java.io.IOException
- Throws:
 java.io.IOException
 
 - 
 
 -