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.Object
Implements 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 long
addEntry(io.netty.buffer.ByteBuf entry)
(package private) abstract void
cancelWaitForLastAddConfirmedUpdate(Watcher<LastAddConfirmedUpdateNotification> watcher)
(package private) abstract void
checkAccess(byte[] masterKey)
(package private) static LedgerDescriptor
create(byte[] masterKey, long ledgerId, LedgerStorage ledgerStorage)
(package private) static io.netty.buffer.ByteBuf
createLedgerFenceEntry(java.lang.Long ledgerId)
(package private) static LedgerDescriptor
createReadOnly(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.ByteBuf
getExplicitLac()
(package private) abstract long
getLastAddConfirmed()
(package private) abstract long
getLedgerId()
(package private) abstract java.util.PrimitiveIterator.OfLong
getListOfEntriesOfLedger(long ledgerId)
(package private) abstract boolean
isFenced()
(package private) abstract io.netty.buffer.ByteBuf
readEntry(long entryId)
(package private) abstract void
setExplicitLac(io.netty.buffer.ByteBuf entry)
(package private) abstract boolean
setFenced()
(package private) abstract boolean
waitForLastAddConfirmedUpdate(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.IOException
Bookie.NoLedgerException
-
createLedgerFenceEntry
static io.netty.buffer.ByteBuf createLedgerFenceEntry(java.lang.Long ledgerId)
-
checkAccess
abstract void checkAccess(byte[] masterKey) throws BookieException, java.io.IOException
- Throws:
BookieException
java.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.IOException
BookieException
-
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.IOException
BookieException
-
readEntry
abstract io.netty.buffer.ByteBuf readEntry(long entryId) throws java.io.IOException, BookieException
- Throws:
java.io.IOException
BookieException
-
getLastAddConfirmed
abstract long getLastAddConfirmed() throws java.io.IOException, BookieException
- Throws:
java.io.IOException
BookieException
-
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.IOException
BookieException
-
getListOfEntriesOfLedger
abstract java.util.PrimitiveIterator.OfLong getListOfEntriesOfLedger(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
-