-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2034 from ClickHouse/v2_implement_writer_api
[client-v2] V2 implement writer api
- Loading branch information
Showing
13 changed files
with
798 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
client-v2/src/main/java/com/clickhouse/client/api/DataStreamWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.clickhouse.client.api; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
public interface DataStreamWriter { | ||
|
||
/** | ||
* Called by client when output stream is ready for user data. | ||
* This method is called once per operation, so all data should be written while the call. | ||
* Output stream will be closed by client. | ||
* When client compression is enabled, then output stream will be a compressing one. | ||
* If {@link ClientConfigProperties#APP_COMPRESSED_DATA} is set for an operation, | ||
* then {@param out} will be raw IO stream without compression. | ||
* @param out - output stream | ||
* @throws IOException - when any IO exceptions happens. | ||
*/ | ||
void onOutput(OutputStream out) throws IOException; | ||
|
||
/** | ||
* Is called when client is going to perform a retry. | ||
* It is optional to implement this method because most cases there is nothing to reset. | ||
* Useful to reset wrapped stream or throw exception to indicate that retry is not supported for a data source. | ||
* @throws IOException - when any IO exception happens. | ||
*/ | ||
default void onRetry() throws IOException {} | ||
} |
Oops, something went wrong.