Skip to content

Commit

Permalink
minor: Fix line endings to dos2unix
Browse files Browse the repository at this point in the history
`find ./ -type f -print0 | xargs -0 dos2unix --`
  • Loading branch information
astubbs committed Jul 23, 2021
1 parent 253f61f commit 1c908fd
Show file tree
Hide file tree
Showing 26 changed files with 3,256 additions and 3,256 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package io.confluent.csid.utils;

/*-
* Copyright (C) 2020-2021 Confluent, Inc.
*/

import io.confluent.parallelconsumer.internal.InternalRuntimeError;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public class JavaUtils {
public static <T> Optional<T> getLast(final List<T> commitHistory) {
if (commitHistory.isEmpty()) return Optional.empty();
return Optional.of(commitHistory.get(commitHistory.size() - 1));
}

public static <T> Optional<T> getOnlyOne(final Map<String, T> stringMapMap) {
if (stringMapMap.isEmpty()) return Optional.empty();
Collection<T> values = stringMapMap.values();
if (values.size() > 1) throw new InternalRuntimeError("More than one element");
return Optional.of(values.iterator().next());
}
}
package io.confluent.csid.utils;

/*-
* Copyright (C) 2020-2021 Confluent, Inc.
*/

import io.confluent.parallelconsumer.internal.InternalRuntimeError;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public class JavaUtils {
public static <T> Optional<T> getLast(final List<T> commitHistory) {
if (commitHistory.isEmpty()) return Optional.empty();
return Optional.of(commitHistory.get(commitHistory.size() - 1));
}

public static <T> Optional<T> getOnlyOne(final Map<String, T> stringMapMap) {
if (stringMapMap.isEmpty()) return Optional.empty();
Collection<T> values = stringMapMap.values();
if (values.size() > 1) throw new InternalRuntimeError("More than one element");
return Optional.of(values.iterator().next());
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package io.confluent.parallelconsumer;

/*-
* Copyright (C) 2020-2021 Confluent, Inc.
*/
import io.confluent.parallelconsumer.internal.DrainingCloseable;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.producer.ProducerRecord;

import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;

public interface JStreamParallelStreamProcessor<K, V> extends DrainingCloseable {

static <KK, VV> JStreamParallelStreamProcessor<KK, VV> createJStreamEosStreamProcessor(ParallelConsumerOptions options) {
return new JStreamParallelEoSStreamProcessor<>(options);
}

/**
* Like {@link ParallelEoSStreamProcessor#pollAndProduceMany} but instead of callbacks, streams the results instead,
* after the produce result is ack'd by Kafka.
*
* @return a stream of results of applying the function to the polled records
*/
Stream<ParallelStreamProcessor.ConsumeProduceResult<K, V, K, V>> pollProduceAndStream(Function<ConsumerRecord<K, V>,
List<ProducerRecord<K, V>>> userFunction);
}
package io.confluent.parallelconsumer;

/*-
* Copyright (C) 2020-2021 Confluent, Inc.
*/
import io.confluent.parallelconsumer.internal.DrainingCloseable;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.producer.ProducerRecord;

import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;

public interface JStreamParallelStreamProcessor<K, V> extends DrainingCloseable {

static <KK, VV> JStreamParallelStreamProcessor<KK, VV> createJStreamEosStreamProcessor(ParallelConsumerOptions options) {
return new JStreamParallelEoSStreamProcessor<>(options);
}

/**
* Like {@link ParallelEoSStreamProcessor#pollAndProduceMany} but instead of callbacks, streams the results instead,
* after the produce result is ack'd by Kafka.
*
* @return a stream of results of applying the function to the polled records
*/
Stream<ParallelStreamProcessor.ConsumeProduceResult<K, V, K, V>> pollProduceAndStream(Function<ConsumerRecord<K, V>,
List<ProducerRecord<K, V>>> userFunction);
}
Loading

0 comments on commit 1c908fd

Please sign in to comment.