@InterfaceAudience.Public @InterfaceStability.Unstable public interface ReadHandle extends Handle
Modifier and Type | Method and Description |
---|---|
long |
getLastAddConfirmed()
Get the last confirmed entry id on this ledger.
|
long |
getLength()
Returns the length of the data written in this ledger so much, in bytes.
|
boolean |
isClosed()
Returns whether the ledger is sealed or not.
|
default LedgerEntries |
read(long firstEntry,
long lastEntry)
Read a sequence of entries synchronously.
|
java.util.concurrent.CompletableFuture<LedgerEntries> |
readAsync(long firstEntry,
long lastEntry)
Read a sequence of entries asynchronously.
|
default long |
readLastAddConfirmed()
Obtains asynchronously the last confirmed write from a quorum of bookies.
|
default LastConfirmedAndEntry |
readLastAddConfirmedAndEntry(long entryId,
long timeOutInMillis,
boolean parallel)
Asynchronous read specific entry and the latest last add confirmed.
|
java.util.concurrent.CompletableFuture<LastConfirmedAndEntry> |
readLastAddConfirmedAndEntryAsync(long entryId,
long timeOutInMillis,
boolean parallel)
Asynchronous read specific entry and the latest last add confirmed.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
readLastAddConfirmedAsync()
Obtains asynchronously the last confirmed write from a quorum of bookies.
|
default LedgerEntries |
readUnconfirmed(long firstEntry,
long lastEntry)
Read a sequence of entries synchronously.
|
java.util.concurrent.CompletableFuture<LedgerEntries> |
readUnconfirmedAsync(long firstEntry,
long lastEntry)
Read a sequence of entries asynchronously, allowing to read after the LastAddConfirmed range.
|
default long |
tryReadLastAddConfirmed()
Obtains asynchronously the last confirmed write from a quorum of bookies
but it doesn't wait all the responses from the quorum.
|
java.util.concurrent.CompletableFuture<java.lang.Long> |
tryReadLastAddConfirmedAsync()
Obtains asynchronously the last confirmed write from a quorum of bookies
but it doesn't wait all the responses from the quorum.
|
close, closeAsync, getId, getLedgerMetadata
java.util.concurrent.CompletableFuture<LedgerEntries> readAsync(long firstEntry, long lastEntry)
firstEntry
- id of first entry of sequencelastEntry
- id of last entry of sequence, inclusivedefault LedgerEntries read(long firstEntry, long lastEntry) throws BKException, java.lang.InterruptedException
firstEntry
- id of first entry of sequencelastEntry
- id of last entry of sequence, inclusiveBKException
java.lang.InterruptedException
java.util.concurrent.CompletableFuture<LedgerEntries> readUnconfirmedAsync(long firstEntry, long lastEntry)
read(long, long)
but it lets the client read without checking the local value of LastAddConfirmed, so that it is possibile to
read entries for which the writer has not received the acknowledge yet. firstEntry
- id of first entry of sequencelastEntry
- id of last entry of sequence, inclusivereadAsync(long, long)
,
readLastAddConfirmedAsync()
default LedgerEntries readUnconfirmed(long firstEntry, long lastEntry) throws BKException, java.lang.InterruptedException
firstEntry
- id of first entry of sequencelastEntry
- id of last entry of sequence, inclusiveBKException
java.lang.InterruptedException
readUnconfirmedAsync(long, long)
java.util.concurrent.CompletableFuture<java.lang.Long> readLastAddConfirmedAsync()
getLastAddConfirmed()
default long readLastAddConfirmed() throws BKException, java.lang.InterruptedException
BKException
java.lang.InterruptedException
readLastAddConfirmedAsync()
java.util.concurrent.CompletableFuture<java.lang.Long> tryReadLastAddConfirmedAsync()
default long tryReadLastAddConfirmed() throws BKException, java.lang.InterruptedException
BKException
java.lang.InterruptedException
tryReadLastAddConfirmedAsync()
long getLastAddConfirmed()
readLastAddConfirmed()
call.
In the case the ledger is not closed and the client is a reader, it is necessary to
call readLastAddConfirmed()
to obtain a fresh value of last add confirmed entry id.
readLastAddConfirmed()
long getLength()
boolean isClosed()
A ledger is sealed when either the client explicitly closes it (WriteHandle.close()
or
Handle.close()
) or another client explicitly open and recovery it
OpenBuilder.withRecovery(boolean)
.
This method only checks the metadata cached locally. The metadata can be not update-to-date because the metadata notification is delayed.
java.util.concurrent.CompletableFuture<LastConfirmedAndEntry> readLastAddConfirmedAndEntryAsync(long entryId, long timeOutInMillis, boolean parallel)
entryId
- next entry id to readtimeOutInMillis
- timeout period to wait for the entry id to be available (for long poll only)
if timeout for get the entry, it will return null entry.parallel
- whether to issue the long poll reads in paralleldefault LastConfirmedAndEntry readLastAddConfirmedAndEntry(long entryId, long timeOutInMillis, boolean parallel) throws BKException, java.lang.InterruptedException
entryId
- next entry id to readtimeOutInMillis
- timeout period to wait for the entry id to be available (for long poll only)
if timeout for get the entry, it will return null entry.parallel
- whether to issue the long poll reads in parallelBKException
java.lang.InterruptedException
readLastAddConfirmedAndEntry(long, long, boolean)
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.