Package org.apache.bookkeeper.client
Class LedgerRecoveryOp
java.lang.Object
org.apache.bookkeeper.client.LedgerRecoveryOp
- All Implemented Interfaces:
AsyncCallback.AddCallback,AsyncCallback.AddCallbackWithLatency,BookkeeperInternalCallbacks.ReadEntryListener
class LedgerRecoveryOp
extends Object
implements BookkeeperInternalCallbacks.ReadEntryListener, AsyncCallback.AddCallback
This class encapsulated the ledger recovery operation. It first does a read
with entry-id of -1 (BookieProtocol.LAST_ADD_CONFIRMED) to all bookies. Then
starting from the last confirmed entry (from hints in the ledger entries),
it reads forward until it is not able to find a particular entry.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ClientContext(package private) long(package private) BookkeeperInternalCallbacks.ReadEntryListener(package private) final LedgerHandle(package private) static final org.slf4j.Logger(package private) LedgerMetadata(package private) final CompletableFuture<LedgerHandle>(package private) final AtomicLong(package private) boolean(package private) long(package private) final AtomicLong -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComplete(int rc, LedgerHandle lh, long entryId, Object ctx) Callback to implement if latency information is not desired.initiate()voidonEntryComplete(int rc, LedgerHandle lh, LedgerEntry entry, Object ctx) On given entry completed.(package private) LedgerRecoveryOpsetEntryListener(BookkeeperInternalCallbacks.ReadEntryListener entryListener) Set an entry listener to listen on individual recovery reads during recovery procedure.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.bookkeeper.client.AsyncCallback.AddCallback
addCompleteWithLatency
-
Field Details
-
LOG
static final org.slf4j.Logger LOG -
lh
-
clientCtx
-
promise
-
readCount
-
writeCount
-
readDone
volatile boolean readDone -
startEntryToRead
volatile long startEntryToRead -
endEntryToRead
volatile long endEntryToRead -
metadataForRecovery
LedgerMetadata metadataForRecovery -
entryListener
BookkeeperInternalCallbacks.ReadEntryListener entryListener
-
-
Constructor Details
-
LedgerRecoveryOp
-
-
Method Details
-
setEntryListener
Set an entry listener to listen on individual recovery reads during recovery procedure.- Parameters:
entryListener- entry listener- Returns:
- ledger recovery operation
-
initiate
-
onEntryComplete
Description copied from interface:BookkeeperInternalCallbacks.ReadEntryListenerOn given entry completed.- Specified by:
onEntryCompletein interfaceBookkeeperInternalCallbacks.ReadEntryListener- Parameters:
rc- result code of reading this entry.lh- ledger handle.entry- ledger entry.ctx- callback context.
-
addComplete
Description copied from interface:AsyncCallback.AddCallbackCallback to implement if latency information is not desired.- Specified by:
addCompletein interfaceAsyncCallback.AddCallback- Parameters:
rc- return codelh- ledger handleentryId- entry identifierctx- context object
-