format source with scalafmt, #26511
This commit is contained in:
parent
2ba9b988df
commit
75579bed17
779 changed files with 15729 additions and 13096 deletions
|
|
@ -352,10 +352,11 @@ object Source {
|
|||
/**
|
||||
* Combines several sources with fan-in strategy like `Merge` or `Concat` and returns `Source`.
|
||||
*/
|
||||
def combine[T, U](first: Source[T, _ <: Any],
|
||||
second: Source[T, _ <: Any],
|
||||
rest: java.util.List[Source[T, _ <: Any]],
|
||||
strategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]])
|
||||
def combine[T, U](
|
||||
first: Source[T, _ <: Any],
|
||||
second: Source[T, _ <: Any],
|
||||
rest: java.util.List[Source[T, _ <: Any]],
|
||||
strategy: function.Function[java.lang.Integer, _ <: Graph[UniformFanInShape[T, U], NotUsed]])
|
||||
: Source[U, NotUsed] = {
|
||||
val seq = if (rest != null) Util.immutableSeq(rest).map(_.asScala) else immutable.Seq()
|
||||
new Source(scaladsl.Source.combine(first.asScala, second.asScala, seq: _*)(num => strategy.apply(num)))
|
||||
|
|
@ -384,8 +385,9 @@ object Source {
|
|||
/*
|
||||
* Combine the elements of multiple streams into a stream of lists using a combiner function.
|
||||
*/
|
||||
def zipWithN[T, O](zipper: function.Function[java.util.List[T], O],
|
||||
sources: java.util.List[Source[T, _ <: Any]]): Source[O, NotUsed] = {
|
||||
def zipWithN[T, O](
|
||||
zipper: function.Function[java.util.List[T], O],
|
||||
sources: java.util.List[Source[T, _ <: Any]]): Source[O, NotUsed] = {
|
||||
val seq = if (sources != null) Util.immutableSeq(sources).map(_.asScala) else immutable.Seq()
|
||||
new Source(scaladsl.Source.zipWithN[T, O](seq => zipper.apply(seq.asJava))(seq))
|
||||
}
|
||||
|
|
@ -451,9 +453,10 @@ object Source {
|
|||
* is received. Stream calls close and completes when `read` returns None.
|
||||
* @param close - function that closes resource
|
||||
*/
|
||||
def unfoldResource[T, S](create: function.Creator[S],
|
||||
read: function.Function[S, Optional[T]],
|
||||
close: function.Procedure[S]): javadsl.Source[T, NotUsed] =
|
||||
def unfoldResource[T, S](
|
||||
create: function.Creator[S],
|
||||
read: function.Function[S, Optional[T]],
|
||||
close: function.Procedure[S]): javadsl.Source[T, NotUsed] =
|
||||
new Source(scaladsl.Source.unfoldResource[T, S](create.create _, (s: S) => read.apply(s).asScala, close.apply))
|
||||
|
||||
/**
|
||||
|
|
@ -476,18 +479,15 @@ object Source {
|
|||
* is received. Stream calls close and completes when `CompletionStage` from read function returns None.
|
||||
* @param close - function that closes resource
|
||||
*/
|
||||
def unfoldResourceAsync[T, S](create: function.Creator[CompletionStage[S]],
|
||||
read: function.Function[S, CompletionStage[Optional[T]]],
|
||||
close: function.Function[S, CompletionStage[Done]]): javadsl.Source[T, NotUsed] =
|
||||
def unfoldResourceAsync[T, S](
|
||||
create: function.Creator[CompletionStage[S]],
|
||||
read: function.Function[S, CompletionStage[Optional[T]]],
|
||||
close: function.Function[S, CompletionStage[Done]]): javadsl.Source[T, NotUsed] =
|
||||
new Source(
|
||||
scaladsl.Source.unfoldResourceAsync[T, S](() => create.create().toScala,
|
||||
(s: S) =>
|
||||
read
|
||||
.apply(s)
|
||||
.toScala
|
||||
.map(_.asScala)(
|
||||
akka.dispatch.ExecutionContexts.sameThreadExecutionContext),
|
||||
(s: S) => close.apply(s).toScala))
|
||||
scaladsl.Source.unfoldResourceAsync[T, S](
|
||||
() => create.create().toScala,
|
||||
(s: S) => read.apply(s).toScala.map(_.asScala)(akka.dispatch.ExecutionContexts.sameThreadExecutionContext),
|
||||
(s: S) => close.apply(s).toScala))
|
||||
|
||||
/**
|
||||
* Upcast a stream of elements to a stream of supertypes of that element. Useful in combination with
|
||||
|
|
@ -588,8 +588,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* It is recommended to use the internally optimized `Keep.left` and `Keep.right` combiners
|
||||
* where appropriate instead of manually writing functions that pass through one of the values.
|
||||
*/
|
||||
def viaMat[T, M, M2](flow: Graph[FlowShape[Out, T], M],
|
||||
combine: function.Function2[Mat, M, M2]): javadsl.Source[T, M2] =
|
||||
def viaMat[T, M, M2](
|
||||
flow: Graph[FlowShape[Out, T], M],
|
||||
combine: function.Function2[Mat, M, M2]): javadsl.Source[T, M2] =
|
||||
new Source(delegate.viaMat(flow)(combinerToScala(combine)))
|
||||
|
||||
/**
|
||||
|
|
@ -660,9 +661,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* function evaluation when the input stream ends, or completed with `Failure`
|
||||
* if there is a failure is signaled in the stream.
|
||||
*/
|
||||
def runFoldAsync[U](zero: U,
|
||||
f: function.Function2[U, Out, CompletionStage[U]],
|
||||
materializer: Materializer): CompletionStage[U] = runWith(Sink.foldAsync(zero, f), materializer)
|
||||
def runFoldAsync[U](
|
||||
zero: U,
|
||||
f: function.Function2[U, Out, CompletionStage[U]],
|
||||
materializer: Materializer): CompletionStage[U] = runWith(Sink.foldAsync(zero, f), materializer)
|
||||
|
||||
/**
|
||||
* Shortcut for running this `Source` with a reduce function.
|
||||
|
|
@ -716,8 +718,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#concat]].
|
||||
*/
|
||||
def concatMat[M, M2](that: Graph[SourceShape[Out], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
def concatMat[M, M2](
|
||||
that: Graph[SourceShape[Out], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
new Source(delegate.concatMat(that)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -756,8 +759,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#prepend]].
|
||||
*/
|
||||
def prependMat[M, M2](that: Graph[SourceShape[Out], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
def prependMat[M, M2](
|
||||
that: Graph[SourceShape[Out], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
new Source(delegate.prependMat(that)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -795,8 +799,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#orElse]]
|
||||
*/
|
||||
def orElseMat[M, M2](secondary: Graph[SourceShape[Out], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
def orElseMat[M, M2](
|
||||
secondary: Graph[SourceShape[Out], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
new Source(delegate.orElseMat(secondary)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -827,8 +832,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#alsoTo]]
|
||||
*/
|
||||
def alsoToMat[M2, M3](that: Graph[SinkShape[Out], M2],
|
||||
matF: function.Function2[Mat, M2, M3]): javadsl.Source[Out, M3] =
|
||||
def alsoToMat[M2, M3](
|
||||
that: Graph[SinkShape[Out], M2],
|
||||
matF: function.Function2[Mat, M2, M3]): javadsl.Source[Out, M3] =
|
||||
new Source(delegate.alsoToMat(that)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -855,9 +861,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* It is recommended to use the internally optimized `Keep.left` and `Keep.right` combiners
|
||||
* where appropriate instead of manually writing functions that pass through one of the values.
|
||||
*/
|
||||
def divertToMat[M2, M3](that: Graph[SinkShape[Out], M2],
|
||||
when: function.Predicate[Out],
|
||||
matF: function.Function2[Mat, M2, M3]): javadsl.Source[Out, M3] =
|
||||
def divertToMat[M2, M3](
|
||||
that: Graph[SinkShape[Out], M2],
|
||||
when: function.Predicate[Out],
|
||||
matF: function.Function2[Mat, M2, M3]): javadsl.Source[Out, M3] =
|
||||
new Source(delegate.divertToMat(that, when.test)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -892,8 +899,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#wireTap]]
|
||||
*/
|
||||
def wireTapMat[M2, M3](that: Graph[SinkShape[Out], M2],
|
||||
matF: function.Function2[Mat, M2, M3]): javadsl.Source[Out, M3] =
|
||||
def wireTapMat[M2, M3](
|
||||
that: Graph[SinkShape[Out], M2],
|
||||
matF: function.Function2[Mat, M2, M3]): javadsl.Source[Out, M3] =
|
||||
new Source(delegate.wireTapMat(that)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -960,9 +968,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#interleave]].
|
||||
*/
|
||||
def interleaveMat[M, M2](that: Graph[SourceShape[Out], M],
|
||||
segmentSize: Int,
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
def interleaveMat[M, M2](
|
||||
that: Graph[SourceShape[Out], M],
|
||||
segmentSize: Int,
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
new Source(delegate.interleaveMat(that, segmentSize)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -981,10 +990,11 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#interleave]]
|
||||
*/
|
||||
def interleaveMat[M, M2](that: Graph[SourceShape[Out], M],
|
||||
segmentSize: Int,
|
||||
eagerClose: Boolean,
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
def interleaveMat[M, M2](
|
||||
that: Graph[SourceShape[Out], M],
|
||||
segmentSize: Int,
|
||||
eagerClose: Boolean,
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out, M2] =
|
||||
new Source(delegate.interleaveMat(that, segmentSize, eagerClose)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -1038,9 +1048,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#merge]]
|
||||
*/
|
||||
def mergeMat[M, M2](that: Graph[SourceShape[Out], M],
|
||||
matF: function.Function2[Mat, M, M2],
|
||||
eagerComplete: Boolean): javadsl.Source[Out, M2] =
|
||||
def mergeMat[M, M2](
|
||||
that: Graph[SourceShape[Out], M],
|
||||
matF: function.Function2[Mat, M, M2],
|
||||
eagerComplete: Boolean): javadsl.Source[Out, M2] =
|
||||
new Source(delegate.mergeMat(that, eagerComplete)(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -1073,9 +1084,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#mergeSorted]].
|
||||
*/
|
||||
def mergeSortedMat[Mat2, Mat3](that: Graph[SourceShape[Out], Mat2],
|
||||
comp: util.Comparator[Out],
|
||||
matF: function.Function2[Mat, Mat2, Mat3]): javadsl.Source[Out, Mat3] =
|
||||
def mergeSortedMat[Mat2, Mat3](
|
||||
that: Graph[SourceShape[Out], Mat2],
|
||||
comp: util.Comparator[Out],
|
||||
matF: function.Function2[Mat, Mat2, Mat3]): javadsl.Source[Out, Mat3] =
|
||||
new Source(delegate.mergeSortedMat(that)(combinerToScala(matF))(Ordering.comparatorToOrdering(comp)))
|
||||
|
||||
/**
|
||||
|
|
@ -1100,8 +1112,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#zip]].
|
||||
*/
|
||||
def zipMat[T, M, M2](that: Graph[SourceShape[T], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out @uncheckedVariance Pair T, M2] =
|
||||
def zipMat[T, M, M2](
|
||||
that: Graph[SourceShape[T], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out @uncheckedVariance Pair T, M2] =
|
||||
this.viaMat(Flow.create[Out].zipMat(that, Keep.right[NotUsed, M]), matF)
|
||||
|
||||
/**
|
||||
|
|
@ -1131,8 +1144,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#zipLatest]].
|
||||
*/
|
||||
def zipLatestMat[T, M, M2](that: Graph[SourceShape[T], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out @uncheckedVariance Pair T, M2] =
|
||||
def zipLatestMat[T, M, M2](
|
||||
that: Graph[SourceShape[T], M],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out @uncheckedVariance Pair T, M2] =
|
||||
this.viaMat(Flow.create[Out].zipLatestMat(that, Keep.right[NotUsed, M]), matF)
|
||||
|
||||
/**
|
||||
|
|
@ -1147,8 +1161,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def zipWith[Out2, Out3](that: Graph[SourceShape[Out2], _],
|
||||
combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] =
|
||||
def zipWith[Out2, Out3](
|
||||
that: Graph[SourceShape[Out2], _],
|
||||
combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] =
|
||||
new Source(delegate.zipWith[Out2, Out3](that)(combinerToScala(combine)))
|
||||
|
||||
/**
|
||||
|
|
@ -1160,9 +1175,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#zipWith]].
|
||||
*/
|
||||
def zipWithMat[Out2, Out3, M, M2](that: Graph[SourceShape[Out2], M],
|
||||
combine: function.Function2[Out, Out2, Out3],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out3, M2] =
|
||||
def zipWithMat[Out2, Out3, M, M2](
|
||||
that: Graph[SourceShape[Out2], M],
|
||||
combine: function.Function2[Out, Out2, Out3],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out3, M2] =
|
||||
new Source(delegate.zipWithMat[Out2, Out3, M, M2](that)(combinerToScala(combine))(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -1182,8 +1198,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* '''Cancels when''' downstream cancels
|
||||
*/
|
||||
def zipLatestWith[Out2, Out3](that: Graph[SourceShape[Out2], _],
|
||||
combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] =
|
||||
def zipLatestWith[Out2, Out3](
|
||||
that: Graph[SourceShape[Out2], _],
|
||||
combine: function.Function2[Out, Out2, Out3]): javadsl.Source[Out3, Mat] =
|
||||
new Source(delegate.zipLatestWith[Out2, Out3](that)(combinerToScala(combine)))
|
||||
|
||||
/**
|
||||
|
|
@ -1196,9 +1213,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* @see [[#zipLatestWith]].
|
||||
*/
|
||||
def zipLatestWithMat[Out2, Out3, M, M2](that: Graph[SourceShape[Out2], M],
|
||||
combine: function.Function2[Out, Out2, Out3],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out3, M2] =
|
||||
def zipLatestWithMat[Out2, Out3, M, M2](
|
||||
that: Graph[SourceShape[Out2], M],
|
||||
combine: function.Function2[Out, Out2, Out3],
|
||||
matF: function.Function2[Mat, M, M2]): javadsl.Source[Out3, M2] =
|
||||
new Source(delegate.zipLatestWithMat[Out2, Out3, M, M2](that)(combinerToScala(combine))(combinerToScala(matF)))
|
||||
|
||||
/**
|
||||
|
|
@ -1373,8 +1391,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
*/
|
||||
def recoverWith(clazz: Class[_ <: Throwable],
|
||||
supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] =
|
||||
def recoverWith(
|
||||
clazz: Class[_ <: Throwable],
|
||||
supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] =
|
||||
recoverWith {
|
||||
case elem if clazz.isInstance(elem) => supplier.get()
|
||||
}
|
||||
|
|
@ -1402,8 +1421,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
*/
|
||||
def recoverWithRetries(attempts: Int,
|
||||
pf: PartialFunction[Throwable, _ <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] =
|
||||
def recoverWithRetries(
|
||||
attempts: Int,
|
||||
pf: PartialFunction[Throwable, _ <: Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] =
|
||||
new Source(delegate.recoverWithRetries(attempts, pf))
|
||||
|
||||
/**
|
||||
|
|
@ -1432,9 +1452,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @param clazz the class object of the failure cause
|
||||
* @param supplier supply the new Source to be materialized
|
||||
*/
|
||||
def recoverWithRetries(attempts: Int,
|
||||
clazz: Class[_ <: Throwable],
|
||||
supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] =
|
||||
def recoverWithRetries(
|
||||
attempts: Int,
|
||||
clazz: Class[_ <: Throwable],
|
||||
supplier: Supplier[Graph[SourceShape[Out], NotUsed]]): Source[Out, Mat] =
|
||||
recoverWithRetries(attempts, {
|
||||
case elem if clazz.isInstance(elem) => supplier.get()
|
||||
})
|
||||
|
|
@ -2044,9 +2065,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.12")
|
||||
def groupedWeightedWithin(maxWeight: Long,
|
||||
costFn: function.Function[Out, java.lang.Long],
|
||||
d: FiniteDuration): javadsl.Source[java.util.List[Out @uncheckedVariance], Mat] =
|
||||
def groupedWeightedWithin(
|
||||
maxWeight: Long,
|
||||
costFn: function.Function[Out, java.lang.Long],
|
||||
d: FiniteDuration): javadsl.Source[java.util.List[Out @uncheckedVariance], Mat] =
|
||||
new Source(delegate.groupedWeightedWithin(maxWeight, d)(costFn.apply).map(_.asJava))
|
||||
|
||||
/**
|
||||
|
|
@ -2067,9 +2089,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* `maxWeight` must be positive, and `d` must be greater than 0 seconds, otherwise
|
||||
* IllegalArgumentException is thrown.
|
||||
*/
|
||||
def groupedWeightedWithin(maxWeight: Long,
|
||||
costFn: function.Function[Out, java.lang.Long],
|
||||
d: java.time.Duration): javadsl.Source[java.util.List[Out @uncheckedVariance], Mat] =
|
||||
def groupedWeightedWithin(
|
||||
maxWeight: Long,
|
||||
costFn: function.Function[Out, java.lang.Long],
|
||||
d: java.time.Duration): javadsl.Source[java.util.List[Out @uncheckedVariance], Mat] =
|
||||
groupedWeightedWithin(maxWeight, costFn, d.asScala)
|
||||
|
||||
/**
|
||||
|
|
@ -2326,8 +2349,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @param seed Provides the first state for a conflated value using the first unconsumed element as a start
|
||||
* @param aggregate Takes the currently aggregated value and the current pending element to produce a new aggregate
|
||||
*/
|
||||
def conflateWithSeed[S](seed: function.Function[Out, S],
|
||||
aggregate: function.Function2[S, Out, S]): javadsl.Source[S, Mat] =
|
||||
def conflateWithSeed[S](
|
||||
seed: function.Function[Out, S],
|
||||
aggregate: function.Function2[S, Out, S]): javadsl.Source[S, Mat] =
|
||||
new Source(delegate.conflateWithSeed(seed.apply)(aggregate.apply))
|
||||
|
||||
/**
|
||||
|
|
@ -2381,9 +2405,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @param seed Provides the first state for a batched value using the first unconsumed element as a start
|
||||
* @param aggregate Takes the currently batched value and the current pending element to produce a new aggregate
|
||||
*/
|
||||
def batch[S](max: Long,
|
||||
seed: function.Function[Out, S],
|
||||
aggregate: function.Function2[S, Out, S]): javadsl.Source[S, Mat] =
|
||||
def batch[S](
|
||||
max: Long,
|
||||
seed: function.Function[Out, S],
|
||||
aggregate: function.Function2[S, Out, S]): javadsl.Source[S, Mat] =
|
||||
new Source(delegate.batch(max, seed.apply)(aggregate.apply))
|
||||
|
||||
/**
|
||||
|
|
@ -2414,10 +2439,11 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @param seed Provides the first state for a batched value using the first unconsumed element as a start
|
||||
* @param aggregate Takes the currently batched value and the current pending element to produce a new batch
|
||||
*/
|
||||
def batchWeighted[S](max: Long,
|
||||
costFn: function.Function[Out, java.lang.Long],
|
||||
seed: function.Function[Out, S],
|
||||
aggregate: function.Function2[S, Out, S]): javadsl.Source[S, Mat] =
|
||||
def batchWeighted[S](
|
||||
max: Long,
|
||||
costFn: function.Function[Out, java.lang.Long],
|
||||
seed: function.Function[Out, S],
|
||||
aggregate: function.Function2[S, Out, S]): javadsl.Source[S, Mat] =
|
||||
new Source(delegate.batchWeighted(max, costFn.apply, seed.apply)(aggregate.apply))
|
||||
|
||||
/**
|
||||
|
|
@ -2502,8 +2528,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @param initial the initial element to be emitted, in case upstream is able to stall the entire stream.
|
||||
* @see [[#expand]]
|
||||
*/
|
||||
def extrapolate(extrapolator: function.Function[Out @uncheckedVariance, java.util.Iterator[Out @uncheckedVariance]],
|
||||
initial: Out @uncheckedVariance): Source[Out, Mat] =
|
||||
def extrapolate(
|
||||
extrapolator: function.Function[Out @uncheckedVariance, java.util.Iterator[Out @uncheckedVariance]],
|
||||
initial: Out @uncheckedVariance): Source[Out, Mat] =
|
||||
new Source(delegate.extrapolate(in => extrapolator(in).asScala, Some(initial)))
|
||||
|
||||
/**
|
||||
|
|
@ -2551,9 +2578,9 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*
|
||||
* '''Cancels when''' downstream cancels or substream cancels
|
||||
*/
|
||||
def prefixAndTail(n: Int)
|
||||
: javadsl.Source[Pair[java.util.List[Out @uncheckedVariance], javadsl.Source[Out @uncheckedVariance, NotUsed]],
|
||||
Mat] =
|
||||
def prefixAndTail(n: Int): javadsl.Source[
|
||||
Pair[java.util.List[Out @uncheckedVariance], javadsl.Source[Out @uncheckedVariance, NotUsed]],
|
||||
Mat] =
|
||||
new Source(delegate.prefixAndTail(n).map { case (taken, tail) => Pair(taken.asJava, tail.asJava) })
|
||||
|
||||
/**
|
||||
|
|
@ -2609,9 +2636,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* @param allowClosedSubstreamRecreation enables recreation of already closed substreams if elements with their
|
||||
* corresponding keys arrive after completion
|
||||
*/
|
||||
def groupBy[K](maxSubstreams: Int,
|
||||
f: function.Function[Out, K],
|
||||
allowClosedSubstreamRecreation: Boolean): SubSource[Out, Mat] =
|
||||
def groupBy[K](
|
||||
maxSubstreams: Int,
|
||||
f: function.Function[Out, K],
|
||||
allowClosedSubstreamRecreation: Boolean): SubSource[Out, Mat] =
|
||||
new SubSource(delegate.groupBy(maxSubstreams, f.apply, allowClosedSubstreamRecreation))
|
||||
|
||||
/**
|
||||
|
|
@ -3095,10 +3123,11 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
*/
|
||||
def throttle(elements: Int,
|
||||
per: java.time.Duration,
|
||||
maximumBurst: Int,
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
def throttle(
|
||||
elements: Int,
|
||||
per: java.time.Duration,
|
||||
maximumBurst: Int,
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
new Source(delegate.throttle(elements, per.asScala, maximumBurst, mode))
|
||||
|
||||
/**
|
||||
|
|
@ -3133,9 +3162,10 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
*/
|
||||
def throttle(cost: Int,
|
||||
per: java.time.Duration,
|
||||
costCalculation: function.Function[Out, Integer]): javadsl.Source[Out, Mat] =
|
||||
def throttle(
|
||||
cost: Int,
|
||||
per: java.time.Duration,
|
||||
costCalculation: function.Function[Out, Integer]): javadsl.Source[Out, Mat] =
|
||||
new Source(delegate.throttle(cost, per.asScala, costCalculation.apply _))
|
||||
|
||||
/**
|
||||
|
|
@ -3179,11 +3209,12 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use the overloaded one which accepts java.time.Duration instead.", since = "2.5.12")
|
||||
def throttle(cost: Int,
|
||||
per: FiniteDuration,
|
||||
maximumBurst: Int,
|
||||
costCalculation: function.Function[Out, Integer],
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
def throttle(
|
||||
cost: Int,
|
||||
per: FiniteDuration,
|
||||
maximumBurst: Int,
|
||||
costCalculation: function.Function[Out, Integer],
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
new Source(delegate.throttle(cost, per, maximumBurst, costCalculation.apply _, mode))
|
||||
|
||||
/**
|
||||
|
|
@ -3225,11 +3256,12 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
* '''Cancels when''' downstream cancels
|
||||
*
|
||||
*/
|
||||
def throttle(cost: Int,
|
||||
per: java.time.Duration,
|
||||
maximumBurst: Int,
|
||||
costCalculation: function.Function[Out, Integer],
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
def throttle(
|
||||
cost: Int,
|
||||
per: java.time.Duration,
|
||||
maximumBurst: Int,
|
||||
costCalculation: function.Function[Out, Integer],
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
new Source(delegate.throttle(cost, per.asScala, maximumBurst, costCalculation.apply _, mode))
|
||||
|
||||
/**
|
||||
|
|
@ -3274,10 +3306,11 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use throttle without `maximumBurst` parameter instead.", "2.5.12")
|
||||
def throttleEven(cost: Int,
|
||||
per: FiniteDuration,
|
||||
costCalculation: (Out) => Int,
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
def throttleEven(
|
||||
cost: Int,
|
||||
per: FiniteDuration,
|
||||
costCalculation: (Out) => Int,
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
new Source(delegate.throttleEven(cost, per, costCalculation.apply _, mode))
|
||||
|
||||
/**
|
||||
|
|
@ -3292,10 +3325,11 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
|
|||
*/
|
||||
@Deprecated
|
||||
@deprecated("Use throttle without `maximumBurst` parameter instead.", "2.5.12")
|
||||
def throttleEven(cost: Int,
|
||||
per: java.time.Duration,
|
||||
costCalculation: (Out) => Int,
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
def throttleEven(
|
||||
cost: Int,
|
||||
per: java.time.Duration,
|
||||
costCalculation: (Out) => Int,
|
||||
mode: ThrottleMode): javadsl.Source[Out, Mat] =
|
||||
throttleEven(cost, per.asScala, costCalculation, mode)
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue