Interface CopyInBuilder


public interface CopyInBuilder
Interface specifying a builder contract to configure a COPY FROM STDIN operation.
Since:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Postgres parse limit for large messages 2^30 - 1 bytes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Build the final publisher that initiates the COPY operation.
    from(byte[] stdin)
    Configure an input buffer that is written to a single CopyData frame.
    from(byte[] stdin, int offset, int length)
    Configure an input buffer along with offset and length whose specified chunk is written to a single CopyData frame.
    from(io.netty.buffer.ByteBuf stdin)
    Configure an input buffer that is written to a single CopyData frame.
    Configure an input buffer that is written to a single CopyData frame.
    from(Publisher<io.netty.buffer.ByteBuf> stdin)
    Configure a Publisher emitting buffers that are written to a single CopyData frame.
    fromMany(Publisher<? extends Publisher<io.netty.buffer.ByteBuf>> stdin)
    Configure a Publisher emitting publishers of buffers that to write data to a CopyData frame per emitted publisher.
  • Field Details

    • MAX_FRAME_SIZE

      static final int MAX_FRAME_SIZE
      Postgres parse limit for large messages 2^30 - 1 bytes.
      See Also:
  • Method Details

    • fromMany

      CopyInBuilder fromMany(Publisher<? extends Publisher<io.netty.buffer.ByteBuf>> stdin)
      Configure a Publisher emitting publishers of buffers that to write data to a CopyData frame per emitted publisher. This method allows controlling flush behavior and chunking of buffers. The provided stream must ensure to not exceed size limits (MAX_FRAME_SIZE) of the CopyData frame.

      If a provided publisher terminates with an error signal then the copy operation terminates with a failure and gets cancelled on the server.

      Parameters:
      stdin - the bytes to write to a CopyData frame.
      Returns:
      this builder.
    • from

      default CopyInBuilder from(Publisher<io.netty.buffer.ByteBuf> stdin)
      Configure a Publisher emitting buffers that are written to a single CopyData frame. If the total amount of data to be written exceeds the copy frame size limitation (MAX_FRAME_SIZE), then use fromMany(Publisher) to split up the input data to many CopyData frames.

      If the provided publisher terminates with an error signal then the copy operation terminates with a failure and gets cancelled on the server.

      Parameters:
      stdin - the bytes to write to a CopyData frame.
      Returns:
      this builder.
    • from

      default CopyInBuilder from(io.netty.buffer.ByteBuf stdin)
      Configure an input buffer that is written to a single CopyData frame.
      Parameters:
      stdin - the bytes to write to a CopyData frame.
      Returns:
      this builder.
    • from

      default CopyInBuilder from(ByteBuffer stdin)
      Configure an input buffer that is written to a single CopyData frame.
      Parameters:
      stdin - the bytes to write to a CopyData frame.
      Returns:
      this builder.
    • from

      default CopyInBuilder from(byte[] stdin)
      Configure an input buffer that is written to a single CopyData frame.
      Parameters:
      stdin - the bytes to write to a CopyData frame.
      Returns:
      this builder.
    • from

      default CopyInBuilder from(byte[] stdin, int offset, int length)
      Configure an input buffer along with offset and length whose specified chunk is written to a single CopyData frame.
      Parameters:
      stdin - the bytes to write to a CopyData frame.
      offset - the start offset in the data.
      length - the number of bytes to write.
      Returns:
      this builder.
    • build

      Mono<Long> build()
      Build the final publisher that initiates the COPY operation. The copy data messages sent to the server are triggered by the provided input buffer. Cancelling the copy operation sends a failure frame to the server to terminate the copy operation with an error.
      Returns:
      the publisher that initiates the COPY operation upon subscription.