Package org.apache.bookkeeper.bookie
Class LedgerDescriptorImpl
java.lang.Object
org.apache.bookkeeper.bookie.LedgerDescriptor
org.apache.bookkeeper.bookie.LedgerDescriptorImpl
- Direct Known Subclasses:
LedgerDescriptorReadOnlyImpl
Implements a ledger inside a bookie. In particular, it implements operations
to write entries to a ledger and read entries from a ledger.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final LedgerStorage(package private) final byte[] -
Constructor Summary
ConstructorsConstructorDescriptionLedgerDescriptorImpl(byte[] masterKey, long ledgerId, LedgerStorage ledgerStorage) -
Method Summary
Modifier and TypeMethodDescription(package private) longaddEntry(io.netty.buffer.ByteBuf entry) (package private) void(package private) voidcheckAccess(byte[] masterKey) (package private) CompletableFuture<Boolean>fenceAndLogInJournal(Journal journal) When we fence a ledger, we need to first set ledger to fenced state in memory and then log the fence entry in Journal so that we can rebuild the state.(package private) io.netty.buffer.ByteBuf(package private) longlong(package private) PrimitiveIterator.OfLonggetListOfEntriesOfLedger(long ledgerId) (package private) booleanisFenced()(package private) io.netty.buffer.ByteBufreadEntry(long entryId) (package private) voidsetExplicitLac(io.netty.buffer.ByteBuf lac) (package private) boolean(package private) booleanwaitForLastAddConfirmedUpdate(long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher) Methods inherited from class org.apache.bookkeeper.bookie.LedgerDescriptor
create, createLedgerFenceEntry, createReadOnly
-
Field Details
-
ledgerStorage
-
masterKey
final byte[] masterKey
-
-
Constructor Details
-
LedgerDescriptorImpl
LedgerDescriptorImpl(byte[] masterKey, long ledgerId, LedgerStorage ledgerStorage)
-
-
Method Details
-
checkAccess
- Specified by:
checkAccessin classLedgerDescriptor- Throws:
BookieExceptionIOException
-
getLedgerId
public long getLedgerId()- Specified by:
getLedgerIdin classLedgerDescriptor
-
setFenced
- Specified by:
setFencedin classLedgerDescriptor- Throws:
IOException
-
isFenced
- Specified by:
isFencedin classLedgerDescriptor- Throws:
IOExceptionBookieException
-
setExplicitLac
- Specified by:
setExplicitLacin classLedgerDescriptor- Throws:
IOException
-
getExplicitLac
- Specified by:
getExplicitLacin classLedgerDescriptor- Throws:
IOExceptionBookieException
-
fenceAndLogInJournal
Description copied from class:LedgerDescriptorWhen we fence a ledger, we need to first set ledger to fenced state in memory and then log the fence entry in Journal so that we can rebuild the state.We should satisfy the future only after we complete logging fence entry in Journal
- Specified by:
fenceAndLogInJournalin classLedgerDescriptor- Returns:
- Throws:
IOException
-
addEntry
- Specified by:
addEntryin classLedgerDescriptor- Throws:
IOExceptionBookieException
-
readEntry
- Specified by:
readEntryin classLedgerDescriptor- Throws:
IOExceptionBookieException
-
getLastAddConfirmed
- Specified by:
getLastAddConfirmedin classLedgerDescriptor- Throws:
IOExceptionBookieException
-
waitForLastAddConfirmedUpdate
boolean waitForLastAddConfirmedUpdate(long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher) throws IOException - Specified by:
waitForLastAddConfirmedUpdatein classLedgerDescriptor- Throws:
IOException
-
cancelWaitForLastAddConfirmedUpdate
void cancelWaitForLastAddConfirmedUpdate(Watcher<LastAddConfirmedUpdateNotification> watcher) throws IOException - Specified by:
cancelWaitForLastAddConfirmedUpdatein classLedgerDescriptor- Throws:
IOException
-
getListOfEntriesOfLedger
- Specified by:
getListOfEntriesOfLedgerin classLedgerDescriptor- Throws:
IOException
-