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.Closeable
This 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 class
LedgerCache.LedgerIndexMetadata
Represents summary of ledger metadata.static class
LedgerCache.NoIndexForLedgerException
Specific exception to encode the case where the index is not present.static interface
LedgerCache.PageEntries
Represents a page of the index.static interface
LedgerCache.PageEntriesIterable
Iterable 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 void
cancelWaitForLastAddConfirmedUpdate(long ledgerId, Watcher<LastAddConfirmedUpdateNotification> watcher)
void
deleteLedger(long ledgerId)
void
flushLedger(boolean doAll)
java.util.PrimitiveIterator.OfLong
getEntriesIterator(long ledgerId)
long
getEntryOffset(long ledger, long entry)
io.netty.buffer.ByteBuf
getExplicitLac(long ledgerId)
java.lang.Long
getLastAddConfirmed(long ledgerId)
long
getLastEntry(long ledgerId)
boolean
isFenced(long ledgerId)
boolean
ledgerExists(long ledgerId)
LedgerCache.PageEntriesIterable
listEntries(long ledgerId)
void
putEntryOffset(long ledger, long entry, long offset)
LedgerCache.LedgerIndexMetadata
readLedgerIndexMetadata(long ledgerId)
byte[]
readMasterKey(long ledgerId)
void
setExplicitLac(long ledgerId, io.netty.buffer.ByteBuf lac)
boolean
setFenced(long ledgerId)
void
setMasterKey(long ledgerId, byte[] masterKey)
long
updateLastAddConfirmed(long ledgerId, long lac)
boolean
waitForLastAddConfirmedUpdate(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.IOException
BookieException
-
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
-
-