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

com.nextbreakpoint.flink.dummies.SampledTemperatureSplit Maven / Gradle / Ivy

There is a newer version: 0.0.6
Show newest version
/*
 * This file is part of Flink Dummies
 * https://github.com/nextbreakpoint/flink-dummies
 */
package com.nextbreakpoint.flink.dummies;

import lombok.Getter;
import org.apache.flink.api.connector.source.lib.util.IteratorSourceSplit;

import java.util.List;
import java.util.Objects;

public class SampledTemperatureSplit implements IteratorSourceSplit {
    private final String splitId;
    @Getter
    private final int maxCount;
    @Getter
    private final long maxDelay;
    @Getter
    private final List sensors;

    public SampledTemperatureSplit(String splitId, int maxCount, long maxDelay, List sensors) {
        this.splitId = Objects.requireNonNull(splitId);
        this.maxCount = maxCount;
        this.maxDelay = maxDelay;
        this.sensors = Objects.requireNonNull(sensors);
    }

    @Override
    public SampledTemperatureIterator getIterator() {
        return new SampledTemperatureIterator(maxCount, maxDelay, sensors);
    }

    @Override
    public IteratorSourceSplit getUpdatedSplitForIterator(SampledTemperatureIterator iterator) {
        return new SampledTemperatureSplit(splitId, iterator.getMaxCount(), iterator.getMaxDelay(), iterator.getSensors());
    }

    @Override
    public String splitId() {
        return splitId;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy