Package org.apache.bookkeeper.client
Class PendingReadOp
- java.lang.Object
-
- org.apache.bookkeeper.client.ReadOpBase
-
- org.apache.bookkeeper.client.PendingReadOp
-
- All Implemented Interfaces:
java.lang.Runnable
,BookkeeperInternalCallbacks.ReadEntryCallback
- Direct Known Subclasses:
ListenerBasedPendingReadOp
class PendingReadOp extends ReadOpBase implements BookkeeperInternalCallbacks.ReadEntryCallback
Sequence of entries of a ledger that represents a pending read operation. When all the data read has come back, the application callback is called. This class could be improved because we could start pushing data to the application as soon as it arrives rather than waiting for the whole thing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
PendingReadOp.ParallelReadRequest
(package private) class
PendingReadOp.SequenceReadRequest
(package private) class
PendingReadOp.SingleLedgerEntryRequest
-
Nested classes/interfaces inherited from class org.apache.bookkeeper.client.ReadOpBase
ReadOpBase.LedgerEntryRequest, ReadOpBase.ReadContext
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
parallelRead
protected java.util.LinkedList<PendingReadOp.SingleLedgerEntryRequest>
seq
-
Fields inherited from class org.apache.bookkeeper.client.ReadOpBase
allowFailFast, clientCtx, complete, endEntryId, future, heardFromHosts, heardFromHostsBitSet, isRecoveryRead, lh, numPendingEntries, requestTimeNanos, requiredBookiesMissingEntryForRecovery, sentToHosts, speculativeTask, startEntryId
-
-
Constructor Summary
Constructors Constructor Description PendingReadOp(LedgerHandle lh, ClientContext clientCtx, long startEntryId, long endEntryId, boolean isRecoveryRead)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
initiate()
(package private) PendingReadOp
parallelRead(boolean enabled)
void
readEntryComplete(int rc, long ledgerId, long entryId, io.netty.buffer.ByteBuf buffer, java.lang.Object ctx)
(package private) void
sendReadTo(int bookieIndex, BookieId to, PendingReadOp.SingleLedgerEntryRequest entry)
protected void
submitCallback(int code)
-
Methods inherited from class org.apache.bookkeeper.client.ReadOpBase
allowFailFastOnUnwritableChannel, cancelSpeculativeTask, future, getLedgerMetadata, getSpeculativeTask, run, submit
-
-
-
-
Field Detail
-
parallelRead
protected boolean parallelRead
-
seq
protected final java.util.LinkedList<PendingReadOp.SingleLedgerEntryRequest> seq
-
-
Constructor Detail
-
PendingReadOp
PendingReadOp(LedgerHandle lh, ClientContext clientCtx, long startEntryId, long endEntryId, boolean isRecoveryRead)
-
-
Method Detail
-
parallelRead
PendingReadOp parallelRead(boolean enabled)
-
initiate
void initiate()
- Specified by:
initiate
in classReadOpBase
-
readEntryComplete
public void readEntryComplete(int rc, long ledgerId, long entryId, io.netty.buffer.ByteBuf buffer, java.lang.Object ctx)
- Specified by:
readEntryComplete
in interfaceBookkeeperInternalCallbacks.ReadEntryCallback
-
submitCallback
protected void submitCallback(int code)
- Specified by:
submitCallback
in classReadOpBase
-
sendReadTo
void sendReadTo(int bookieIndex, BookieId to, PendingReadOp.SingleLedgerEntryRequest entry) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
-