You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extract builder API to enable flexibility in providing copy data. Add safeguards to terminate copy data in cases of cancellation or errors. Reorder methods.
[resolves#500][#183]
Signed-off-by: Mark Paluch <[email protected]>
* Interface specifying a builder contract to configure a {@code COPY FROM STDIN} operation.
29
+
*
30
+
* @since 1.0
31
+
*/
32
+
publicinterfaceCopyInBuilder {
33
+
34
+
/**
35
+
* Postgres parse limit for large messages {@code 2^30 - 1} bytes.
36
+
*/
37
+
intMAX_FRAME_SIZE = 0x3fffffff - 1;
38
+
39
+
/**
40
+
* Configure a {@link Publisher} emitting publishers of buffers that to write data to a {@link CopyData} frame per emitted publisher.
41
+
* This method allows controlling flush behavior and chunking of buffers. The provided stream must ensure to not exceed size limits ({@link #MAX_FRAME_SIZE}) of the {@link CopyData} frame.
42
+
* <p>If a provided publisher terminates with an error signal then the copy operation terminates with a failure and gets cancelled on the server.
43
+
*
44
+
* @param stdin the bytes to write to a {@link CopyData} frame.
* Configure a {@link Publisher} emitting buffers that are written to a single {@link CopyData} frame.
51
+
* If the total amount of data to be written exceeds the copy frame size limitation ({@link #MAX_FRAME_SIZE}), then use {@link #fromMany(Publisher)} to split up the input data to many
52
+
* {@link CopyData} frames.
53
+
* <p>If the provided publisher terminates with an error signal then the copy operation terminates with a failure and gets cancelled on the server.
54
+
*
55
+
* @param stdin the bytes to write to a {@link CopyData} frame.
* Build the final publisher that initiates the {@code COPY} operation. The copy data messages sent to the server are triggered by the provided input buffer.
106
+
* Cancelling the copy operation sends a failure frame to the server to terminate the copy operation with an error.
107
+
*
108
+
* @return the publisher that initiates the {@code COPY} operation upon subscription.
0 commit comments