Package org.apache.bookkeeper.client.api
Interface WriteAdvHandle
-
- All Superinterfaces:
java.lang.AutoCloseable
,ForceableHandle
,Handle
,ReadHandle
- All Known Implementing Classes:
LedgerHandleAdv
@Public @Unstable public interface WriteAdvHandle extends ReadHandle, ForceableHandle
Provide write access to a ledger. Using WriteAdvHandler the writer MUST explictly set an entryId. Beware that the write for a given entryId will be acknowledged if and only if all entries up to entryId - 1 have been acknowledged too (expected from entryId 0)- Since:
- 4.6
- See Also:
WriteHandle
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default long
write(long entryId, byte[] data)
Add entry synchronously to an open ledger.default long
write(long entryId, byte[] data, int offset, int length)
Add entry synchronously to an open ledger.default long
write(long entryId, io.netty.buffer.ByteBuf data)
Add entry asynchronously to an open ledger.default long
write(long entryId, java.nio.ByteBuffer data)
Add entry synchronously to an open ledger.default java.util.concurrent.CompletableFuture<java.lang.Long>
writeAsync(long entryId, byte[] data)
Add entry asynchronously to an open ledger.default java.util.concurrent.CompletableFuture<java.lang.Long>
writeAsync(long entryId, byte[] data, int offset, int length)
Add entry asynchronously to an open ledger.java.util.concurrent.CompletableFuture<java.lang.Long>
writeAsync(long entryId, io.netty.buffer.ByteBuf data)
Add entry asynchronously to an open ledger.default java.util.concurrent.CompletableFuture<java.lang.Long>
writeAsync(long entryId, java.nio.ByteBuffer data)
Add entry asynchronously to an open ledger.-
Methods inherited from interface org.apache.bookkeeper.client.api.ForceableHandle
force
-
Methods inherited from interface org.apache.bookkeeper.client.api.Handle
close, closeAsync, getId, getLedgerMetadata
-
Methods inherited from interface org.apache.bookkeeper.client.api.ReadHandle
getLastAddConfirmed, getLength, isClosed, read, readAsync, readLastAddConfirmed, readLastAddConfirmedAndEntry, readLastAddConfirmedAndEntryAsync, readLastAddConfirmedAsync, readUnconfirmed, readUnconfirmedAsync, tryReadLastAddConfirmed, tryReadLastAddConfirmedAsync
-
-
-
-
Method Detail
-
writeAsync
default java.util.concurrent.CompletableFuture<java.lang.Long> writeAsync(long entryId, java.nio.ByteBuffer data)
Add entry asynchronously to an open ledger.- Parameters:
entryId
- entryId to be addeddata
- array of bytes to be written do not reuse the buffer, bk-client will release it appropriately.- Returns:
- an handle to the result, in case of success it will return the same value of param entryId.
-
write
default long write(long entryId, java.nio.ByteBuffer data) throws BKException, java.lang.InterruptedException
Add entry synchronously to an open ledger.- Parameters:
entryId
- entryId to be addeddata
- array of bytes to be written do not reuse the buffer, bk-client will release it appropriately.- Returns:
- the same value of param entryId.
- Throws:
BKException
java.lang.InterruptedException
-
writeAsync
default java.util.concurrent.CompletableFuture<java.lang.Long> writeAsync(long entryId, byte[] data)
Add entry asynchronously to an open ledger.- Parameters:
entryId
- entryId to be added.data
- array of bytes to be written do not reuse the buffer, bk-client will release it appropriately.- Returns:
- an handle to the result, in case of success it will return the same value of param
entryId
.
-
write
default long write(long entryId, byte[] data) throws BKException, java.lang.InterruptedException
Add entry synchronously to an open ledger.- Parameters:
entryId
- entryId to be added.data
- array of bytes to be written do not reuse the buffer, bk-client will release it appropriately.- Returns:
- same value of param
entryId
. - Throws:
BKException
java.lang.InterruptedException
-
writeAsync
default java.util.concurrent.CompletableFuture<java.lang.Long> writeAsync(long entryId, byte[] data, int offset, int length)
Add entry asynchronously to an open ledger.- Parameters:
entryId
- entryId to be added.data
- array of bytes to be written do not reuse the buffer, bk-client will release it appropriately.offset
- the offset of the bytes arraylength
- the length to data to write- Returns:
- an handle to the result, in case of success it will return the same value of param
entryId
.
-
write
default long write(long entryId, byte[] data, int offset, int length) throws BKException, java.lang.InterruptedException
Add entry synchronously to an open ledger.- Parameters:
entryId
- entryId to be added.data
- array of bytes to be written do not reuse the buffer, bk-client will release it appropriately.offset
- the offset of the bytes arraylength
- the length to data to write- Returns:
- the same value of param
entryId
. - Throws:
BKException
java.lang.InterruptedException
-
writeAsync
java.util.concurrent.CompletableFuture<java.lang.Long> writeAsync(long entryId, io.netty.buffer.ByteBuf data)
Add entry asynchronously to an open ledger.- Parameters:
entryId
- entryId to be addeddata
- array of bytes to be written do not reuse the buffer, bk-client will release it appropriately.- Returns:
- an handle to the result, in case of success it will return the same value of param entryId
-
write
default long write(long entryId, io.netty.buffer.ByteBuf data) throws BKException, java.lang.InterruptedException
Add entry asynchronously to an open ledger.- Parameters:
entryId
- entryId to be addeddata
- array of bytes to be written do not reuse the buffer, bk-client will release it appropriately.- Returns:
- the same value of param entryId
- Throws:
BKException
java.lang.InterruptedException
-
-