com.kolibrifx.plovercrest.server.internal.folds.FoldReaderInputs Maven / Gradle / Ivy
Show all versions of plovercrest-server Show documentation
/*
* Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
*/
package com.kolibrifx.plovercrest.server.internal.folds;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.tuple.ImmutablePair;
import com.kolibrifx.plovercrest.server.streams.Stream;
/**
* Specifies how input streams are set up when reading from a fold stream.
*
* Adding inputs both decides the ordering of the readers (which can be significant if the inputs
* have elements on the same timestamp) and the timestamps that each input should read from.
*/
public class FoldReaderInputs {
private final List, Long>> inputs = new ArrayList<>();
public void addInput(final Stream extends T> stream, final long fromTimestamp) {
inputs.add(new ImmutablePair, Long>(stream, fromTimestamp));
}
public void addInputs(final Collection> streams, final long fromTimestamp) {
for (final Stream extends T> s : streams) {
addInput(s, fromTimestamp);
}
}
public List, Long>> getInputs() {
return Collections.unmodifiableList(inputs);
}
}