tech.ytsaurus.client.FileWriter Maven / Gradle / Ivy
The newest version!
package tech.ytsaurus.client;
import java.util.concurrent.CompletableFuture;
public interface FileWriter {
/**
* Returns an asynchronous flag enabling to wait until data is written.
*/
CompletableFuture readyEvent();
/**
* Attempts to write a bunch of {@code data}.
*
* If false is returned then the rows
* are not accepted and the client must invoke {@link #readyEvent} and wait.
*/
boolean write(byte[] data, int offset, int len);
default boolean write(byte[] data) {
return write(data, 0, data.length);
}
/**
* Closes the writer. Must be the last call to the writer.
*/
CompletableFuture> close();
void cancel();
}