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

tech.ydb.topic.read.impl.events.StartPartitionSessionEventImpl Maven / Gradle / Ivy

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

import java.util.function.Consumer;

import tech.ydb.topic.description.OffsetsRange;
import tech.ydb.topic.read.PartitionSession;
import tech.ydb.topic.read.events.StartPartitionSessionEvent;
import tech.ydb.topic.settings.StartPartitionSessionSettings;

/**
 * @author Nikolay Perfilov
 */
public class StartPartitionSessionEventImpl implements StartPartitionSessionEvent {
    private final PartitionSession partitionSession;
    private final long committedOffset;
    private final OffsetsRange partitionOffsets;
    private final Consumer confirmCallback;

    public StartPartitionSessionEventImpl(PartitionSession partitionSession, long committedOffset,
                                          OffsetsRange partitionOffsets,
                                          Consumer confirmCallback) {
        this.partitionSession = partitionSession;
        this.committedOffset = committedOffset;
        this.partitionOffsets = partitionOffsets;
        this.confirmCallback = confirmCallback;
    }

    @Override
    public PartitionSession getPartitionSession() {
        return partitionSession;
    }

    @Override
    public long getCommittedOffset() {
        return committedOffset;
    }

    @Override
    public OffsetsRange getPartitionOffsets() {
        return partitionOffsets;
    }

    @Override
    public void confirm() {
        confirmCallback.accept(null);
    }

    @Override
    public void confirm(StartPartitionSessionSettings settings) {
        confirmCallback.accept(settings);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy