Package org.apache.bookkeeper.bookie
Interface Bookie
-
- All Known Implementing Classes:
BookieImpl
,ReadOnlyBookie
public interface Bookie
Interface for the bookie.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Bookie.NoEntryException
Exception is thrown when no such an entry is found in this bookie.static class
Bookie.NoLedgerException
Exception is thrown when no such a ledger is found in this bookie.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEntry(io.netty.buffer.ByteBuf entry, boolean ackBeforeSync, BookkeeperInternalCallbacks.WriteCallback cb, java.lang.Object ctx, byte[] masterKey)
void
cancelWaitForLastAddConfirmedUpdate(long ledgerId, Watcher<LastAddConfirmedUpdateNotification> watcher)
java.util.concurrent.CompletableFuture<java.lang.Boolean>
fenceLedger(long ledgerId, byte[] masterKey)
Fences a ledger.void
forceLedger(long ledgerId, BookkeeperInternalCallbacks.WriteCallback cb, java.lang.Object ctx)
int
getExitCode()
io.netty.buffer.ByteBuf
getExplicitLac(long ledgerId)
LedgerStorage
getLedgerStorage()
java.util.PrimitiveIterator.OfLong
getListOfEntriesOfLedger(long ledgerId)
StateManager
getStateManager()
long
getTotalDiskSpace()
long
getTotalFreeSpace()
boolean
isAvailableForHighPriorityWrites()
boolean
isReadOnly()
boolean
isRunning()
void
join()
io.netty.buffer.ByteBuf
readEntry(long ledgerId, long entryId)
long
readLastAddConfirmed(long ledgerId)
void
recoveryAddEntry(io.netty.buffer.ByteBuf entry, BookkeeperInternalCallbacks.WriteCallback cb, java.lang.Object ctx, byte[] masterKey)
void
setExplicitLac(io.netty.buffer.ByteBuf entry, BookkeeperInternalCallbacks.WriteCallback writeCallback, java.lang.Object ctx, byte[] masterKey)
int
shutdown()
void
start()
boolean
waitForLastAddConfirmedUpdate(long ledgerId, long previousLAC, Watcher<LastAddConfirmedUpdateNotification> watcher)
-
-
-
Method Detail
-
start
void start()
-
join
void join() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
isRunning
boolean isRunning()
-
getExitCode
int getExitCode()
-
shutdown
int shutdown()
-
isAvailableForHighPriorityWrites
boolean isAvailableForHighPriorityWrites()
-
isReadOnly
boolean isReadOnly()
-
addEntry
void addEntry(io.netty.buffer.ByteBuf entry, boolean ackBeforeSync, BookkeeperInternalCallbacks.WriteCallback cb, java.lang.Object ctx, byte[] masterKey) throws java.io.IOException, BookieException, java.lang.InterruptedException
- Throws:
java.io.IOException
BookieException
java.lang.InterruptedException
-
recoveryAddEntry
void recoveryAddEntry(io.netty.buffer.ByteBuf entry, BookkeeperInternalCallbacks.WriteCallback cb, java.lang.Object ctx, byte[] masterKey) throws java.io.IOException, BookieException, java.lang.InterruptedException
- Throws:
java.io.IOException
BookieException
java.lang.InterruptedException
-
forceLedger
void forceLedger(long ledgerId, BookkeeperInternalCallbacks.WriteCallback cb, java.lang.Object ctx)
-
setExplicitLac
void setExplicitLac(io.netty.buffer.ByteBuf entry, BookkeeperInternalCallbacks.WriteCallback writeCallback, java.lang.Object ctx, byte[] masterKey) throws java.io.IOException, java.lang.InterruptedException, BookieException
- Throws:
java.io.IOException
java.lang.InterruptedException
BookieException
-
getExplicitLac
io.netty.buffer.ByteBuf getExplicitLac(long ledgerId) throws java.io.IOException, Bookie.NoLedgerException, BookieException
- Throws:
java.io.IOException
Bookie.NoLedgerException
BookieException
-
getTotalDiskSpace
long getTotalDiskSpace() throws java.io.IOException
- Throws:
java.io.IOException
-
getTotalFreeSpace
long getTotalFreeSpace() throws java.io.IOException
- Throws:
java.io.IOException
-
readEntry
io.netty.buffer.ByteBuf readEntry(long ledgerId, long entryId) throws java.io.IOException, Bookie.NoLedgerException, BookieException
- Throws:
java.io.IOException
Bookie.NoLedgerException
BookieException
-
readLastAddConfirmed
long readLastAddConfirmed(long ledgerId) throws java.io.IOException, BookieException
- Throws:
java.io.IOException
BookieException
-
getListOfEntriesOfLedger
java.util.PrimitiveIterator.OfLong getListOfEntriesOfLedger(long ledgerId) throws java.io.IOException, Bookie.NoLedgerException
- Throws:
java.io.IOException
Bookie.NoLedgerException
-
fenceLedger
java.util.concurrent.CompletableFuture<java.lang.Boolean> fenceLedger(long ledgerId, byte[] masterKey) throws java.io.IOException, BookieException
Fences a ledger. From this point on, clients will be unable to write to this ledger. Only recoveryAddEntry will be able to add entries to the ledger. This method is idempotent. Once a ledger is fenced, it can never be unfenced. Fencing a fenced ledger has no effect.- Returns:
- Throws:
java.io.IOException
BookieException
-
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
-
getStateManager
StateManager getStateManager()
-
getLedgerStorage
LedgerStorage getLedgerStorage()
-
-