Package org.apache.bookkeeper.client.api
Interface WriteAdvHandle
- All Superinterfaces:
AutoCloseable,ForceableHandle,Handle,ReadHandle
- All Known Implementing Classes:
LedgerHandleAdv
Provide write access to a ledger. Using WriteAdvHandler the writer MUST explicitly 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:
-
Method Summary
Modifier and TypeMethodDescriptiondefault longwrite(long entryId, byte[] data) Add entry synchronously to an open ledger.default longwrite(long entryId, byte[] data, int offset, int length) Add entry synchronously to an open ledger.default longwrite(long entryId, io.netty.buffer.ByteBuf data) Add entry asynchronously to an open ledger.default longwrite(long entryId, ByteBuffer data) Add entry synchronously to an open ledger.default CompletableFuture<Long>writeAsync(long entryId, byte[] data) Add entry asynchronously to an open ledger.default CompletableFuture<Long>writeAsync(long entryId, byte[] data, int offset, int length) Add entry asynchronously to an open ledger.writeAsync(long entryId, io.netty.buffer.ByteBuf data) Add entry asynchronously to an open ledger.default CompletableFuture<Long>writeAsync(long entryId, ByteBuffer data) Add entry asynchronously to an open ledger.Methods inherited from interface org.apache.bookkeeper.client.api.ForceableHandle
forceMethods inherited from interface org.apache.bookkeeper.client.api.Handle
close, closeAsync, getId, getLedgerMetadataMethods inherited from interface org.apache.bookkeeper.client.api.ReadHandle
batchRead, batchReadAsync, getLastAddConfirmed, getLength, isClosed, read, readAsync, readLastAddConfirmed, readLastAddConfirmedAndEntry, readLastAddConfirmedAndEntryAsync, readLastAddConfirmedAsync, readUnconfirmed, readUnconfirmedAsync, tryReadLastAddConfirmed, tryReadLastAddConfirmedAsync
-
Method Details
-
writeAsync
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
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:
BKExceptionInterruptedException
-
writeAsync
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
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:
BKExceptionInterruptedException
-
writeAsync
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, 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:
BKExceptionInterruptedException
-
writeAsync
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, 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:
BKExceptionInterruptedException
-