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 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 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,
                           java.nio.ByteBuffer 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:
        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 array
        length - 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 array
        length - 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 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,
                           io.netty.buffer.ByteBuf data)
                    throws BKException,
                           java.lang.InterruptedException
        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:
        the same value of param entryId
        Throws:
        BKException
        java.lang.InterruptedException