tech.ydb.topic.read.impl.Batch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ydb-sdk-topic Show documentation
Show all versions of ydb-sdk-topic Show documentation
Topic client implementation
package tech.ydb.topic.read.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import tech.ydb.topic.description.Codec;
/**
* @author Nikolay Perfilov
*/
public class Batch {
private final BatchMeta meta;
private final List messages = new ArrayList<>();
// Completes when batch is read
private final CompletableFuture readFuture = new CompletableFuture<>();
private boolean decompressed = false;
public Batch(BatchMeta meta) {
this.meta = meta;
}
public List getMessages() {
return messages;
}
public void addMessage(MessageImpl message) {
messages.add(message);
}
public void complete() {
readFuture.complete(null);
}
public CompletableFuture getReadFuture() {
return readFuture;
}
public Codec getCodec() {
return meta.getCodec();
}
public boolean isDecompressed() {
return decompressed;
}
public void setDecompressed(boolean decompressed) {
this.decompressed = decompressed;
}
}