All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.ydb.topic.read.impl.BatchMeta Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package tech.ydb.topic.read.impl;

import java.time.Instant;
import java.util.Map;

import tech.ydb.core.utils.ProtobufUtils;
import tech.ydb.proto.topic.YdbTopic;
import tech.ydb.topic.description.Codec;

/**
 * @author Nikolay Perfilov
 */
public class BatchMeta {
    private final String producerId;
    private final Map writeSessionMeta;
    private final Codec codec;
    private final Instant writtenAt;

    public BatchMeta(YdbTopic.StreamReadMessage.ReadResponse.Batch batch) {
        this.producerId = batch.getProducerId();
        this.writeSessionMeta = batch.getWriteSessionMetaMap();
        this.codec = tech.ydb.topic.utils.ProtoUtils.codecFromProto(batch.getCodec());
        this.writtenAt = ProtobufUtils.protoToInstant(batch.getWrittenAt());
    }

    public String getProducerId() {
        return producerId;
    }

    public Map getWriteSessionMeta() {
        return writeSessionMeta;
    }

    public Codec getCodec() {
        return codec;
    }

    public Instant getWrittenAt() {
        return writtenAt;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy