Package org.apache.bookkeeper.bookie
Class LedgerDescriptor
- java.lang.Object
-
- org.apache.bookkeeper.bookie.LedgerDescriptor
-
- Direct Known Subclasses:
LedgerDescriptorImpl
public abstract class LedgerDescriptor extends java.lang.ObjectImplements a ledger inside a bookie. In particular, it implements operations to write entries to a ledger and read entries from a ledger.
-
-
Constructor Summary
Constructors Constructor Description LedgerDescriptor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract longaddEntry(io.netty.buffer.ByteBuf entry)(package private) abstract voidcancelWaitForLastAddConfirmedUpdate(Watcher<LastAddConfirmedUpdateNotification> watcher)(package private) abstract voidcheckAccess(byte[] masterKey)(package private) static LedgerDescriptorcreate(byte[] masterKey, long ledgerId, LedgerStorage ledgerStorage)(package private) static io.netty.buffer.ByteBufcreateLedgerFenceEntry(java.lang.Long ledgerId)(package private) static LedgerDescriptorcreateReadOnly(long ledgerId, LedgerStorage ledgerStorage)(package private) abstract java.util.concurrent.CompletableFuture<java.lang.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) abstract io.netty.buffer.ByteBufgetExplicitLac()(package private) abstract longgetLastAddConfirmed()(package private) abstract longgetLedgerId()(package private) abstract java.util.PrimitiveIterator.OfLonggetListOfEntriesOfLedger(long ledgerId)(package private) abstract booleanisFenced()(package private) abstract io.netty.buffer.ByteBufreadEntry(long entryId)(package private) abstract voidsetExplicitLac(io.netty.buffer.ByteBuf entry)(package private) abstract booleansetFenced()(package private) abstract booleanwaitForLastAddConfirmedUpdate(long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher)
-
-
-
Method Detail
-
create
static LedgerDescriptor create(byte[] masterKey, long ledgerId, LedgerStorage ledgerStorage) throws java.io.IOException
- Throws:
java.io.IOException
-
createReadOnly
static LedgerDescriptor createReadOnly(long ledgerId, LedgerStorage ledgerStorage) throws java.io.IOException, Bookie.NoLedgerException
- Throws:
java.io.IOExceptionBookie.NoLedgerException
-
createLedgerFenceEntry
static io.netty.buffer.ByteBuf createLedgerFenceEntry(java.lang.Long ledgerId)
-
checkAccess
abstract void checkAccess(byte[] masterKey) throws BookieException, java.io.IOException- Throws:
BookieExceptionjava.io.IOException
-
getLedgerId
abstract long getLedgerId()
-
setFenced
abstract boolean setFenced() throws java.io.IOException- Throws:
java.io.IOException
-
isFenced
abstract boolean isFenced() throws java.io.IOException, BookieException- Throws:
java.io.IOExceptionBookieException
-
fenceAndLogInJournal
abstract java.util.concurrent.CompletableFuture<java.lang.Boolean> fenceAndLogInJournal(Journal journal) throws java.io.IOException
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.We should satisfy the future only after we complete logging fence entry in Journal
- Returns:
- Throws:
java.io.IOException
-
addEntry
abstract long addEntry(io.netty.buffer.ByteBuf entry) throws java.io.IOException, BookieException- Throws:
java.io.IOExceptionBookieException
-
readEntry
abstract io.netty.buffer.ByteBuf readEntry(long entryId) throws java.io.IOException, BookieException- Throws:
java.io.IOExceptionBookieException
-
getLastAddConfirmed
abstract long getLastAddConfirmed() throws java.io.IOException, BookieException- Throws:
java.io.IOExceptionBookieException
-
waitForLastAddConfirmedUpdate
abstract boolean waitForLastAddConfirmedUpdate(long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher) throws java.io.IOException- Throws:
java.io.IOException
-
cancelWaitForLastAddConfirmedUpdate
abstract void cancelWaitForLastAddConfirmedUpdate(Watcher<LastAddConfirmedUpdateNotification> watcher) throws java.io.IOException
- Throws:
java.io.IOException
-
setExplicitLac
abstract void setExplicitLac(io.netty.buffer.ByteBuf entry) throws java.io.IOException- Throws:
java.io.IOException
-
getExplicitLac
abstract io.netty.buffer.ByteBuf getExplicitLac() throws java.io.IOException, BookieException- Throws:
java.io.IOExceptionBookieException
-
getListOfEntriesOfLedger
abstract java.util.PrimitiveIterator.OfLong getListOfEntriesOfLedger(long ledgerId) throws java.io.IOException- Throws:
java.io.IOException
-
-