Adds gzip and deflate to the operator list (#28644)
This commit is contained in:
parent
427a3cff42
commit
b5ddc2f224
5 changed files with 80 additions and 0 deletions
1
akka-docs/src/main/categories/compression-operators.md
Normal file
1
akka-docs/src/main/categories/compression-operators.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Flow operators to (de)compress.
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Compression.deflate
|
||||||
|
|
||||||
|
Creates a flow that deflate-compresses a stream of ByteStrings.
|
||||||
|
|
||||||
|
@ref[Compression operators](../index.md#compression-operators)
|
||||||
|
|
||||||
|
## Signature
|
||||||
|
|
||||||
|
@apidoc[Compression.deflate](stream.*.Compression$) { scala="#deflate:akka.stream.scaladsl.Flow[akka.util.ByteString,akka.util.ByteString,akka.NotUsed]" java="#deflate()" }
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
Creates a flow that deflate-compresses a stream of ByteStrings. Note that the compressor
|
||||||
|
will SYNC_FLUSH after every @apidoc[akka.util.ByteString] so that it is guaranteed that every @apidoc[akka.util.ByteString]
|
||||||
|
coming out of the flow can be fully decompressed without waiting for additional data. This may
|
||||||
|
come at a compression performance cost for very small chunks.
|
||||||
|
|
||||||
|
Use the overload method with parameters to control the compression level and compatibility with GZip.
|
||||||
|
|
||||||
|
## Reactive Streams semantics
|
||||||
|
|
||||||
|
@@@div { .callout }
|
||||||
|
|
||||||
|
**emits** when the compression algorithm produces output for the received `ByteString`
|
||||||
|
|
||||||
|
**backpressures** when downstream backpressures
|
||||||
|
|
||||||
|
**completes** when upstream completes (may emit finishing bytes in an extra `ByteString` )
|
||||||
|
|
||||||
|
@@@
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Compression.gzip
|
||||||
|
|
||||||
|
Creates a flow that gzip-compresses a stream of ByteStrings.
|
||||||
|
|
||||||
|
@ref[Compression operators](../index.md#compression-operators)
|
||||||
|
|
||||||
|
## Signature
|
||||||
|
|
||||||
|
@apidoc[Compression.gzip](stream.*.Compression$) { scala="#gzip:akka.stream.scaladsl.Flow[akka.util.ByteString,akka.util.ByteString,akka.NotUsed]" java="#gzip()" }
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
Creates a flow that gzip-compresses a stream of ByteStrings. Note that the compressor
|
||||||
|
will SYNC_FLUSH after every @apidoc[akka.util.ByteString] so that it is guaranteed that every @apidoc[akka.util.ByteString]
|
||||||
|
coming out of the flow can be fully decompressed without waiting for additional data. This may
|
||||||
|
come at a compression performance cost for very small chunks.
|
||||||
|
|
||||||
|
Use the overload method to control the compression level.
|
||||||
|
|
||||||
|
## Reactive Streams semantics
|
||||||
|
|
||||||
|
@@@div { .callout }
|
||||||
|
|
||||||
|
**emits** when the compression algorithm produces output for the received `ByteString`
|
||||||
|
|
||||||
|
**backpressures** when downstream backpressures
|
||||||
|
|
||||||
|
**completes** when upstream completes
|
||||||
|
|
||||||
|
@@@
|
||||||
|
|
@ -323,6 +323,15 @@ Operators meant for inter-operating between Akka Streams and Actors:
|
||||||
|ActorSink|<a name="actorrefwithbackpressure"></a>@ref[actorRefWithBackpressure](ActorSink/actorRefWithBackpressure.md)|Sends the elements of the stream to the given @java[`ActorRef<T>`]@scala[`ActorRef[T]`] with backpressure, to be able to signal demand when the actor is ready to receive more elements.|
|
|ActorSink|<a name="actorrefwithbackpressure"></a>@ref[actorRefWithBackpressure](ActorSink/actorRefWithBackpressure.md)|Sends the elements of the stream to the given @java[`ActorRef<T>`]@scala[`ActorRef[T]`] with backpressure, to be able to signal demand when the actor is ready to receive more elements.|
|
||||||
|ActorFlow|<a name="ask"></a>@ref[ask](ActorFlow/ask.md)|Use the `AskPattern` to send each element as an `ask` to the target actor, and expect a reply back that will be sent further downstream.|
|
|ActorFlow|<a name="ask"></a>@ref[ask](ActorFlow/ask.md)|Use the `AskPattern` to send each element as an `ask` to the target actor, and expect a reply back that will be sent further downstream.|
|
||||||
|
|
||||||
|
## Compression operators
|
||||||
|
|
||||||
|
Flow operators to (de)compress.
|
||||||
|
|
||||||
|
| |Operator|Description|
|
||||||
|
|--|--|--|
|
||||||
|
|Compression|<a name="deflate"></a>@ref[deflate](Compression/deflate.md)|Creates a flow that deflate-compresses a stream of ByteStrings. |
|
||||||
|
|Compression|<a name="gzip"></a>@ref[gzip](Compression/gzip.md)|Creates a flow that gzip-compresses a stream of ByteStrings. |
|
||||||
|
|
||||||
## Error handling
|
## Error handling
|
||||||
|
|
||||||
For more background see the @ref[Error Handling in Streams](../stream-error.md) section.
|
For more background see the @ref[Error Handling in Streams](../stream-error.md) section.
|
||||||
|
|
@ -516,6 +525,8 @@ For more background see the @ref[Error Handling in Streams](../stream-error.md)
|
||||||
* [withBackoff](RestartSink/withBackoff.md)
|
* [withBackoff](RestartSink/withBackoff.md)
|
||||||
* [withBackoff](RetryFlow/withBackoff.md)
|
* [withBackoff](RetryFlow/withBackoff.md)
|
||||||
* [withBackoffAndContext](RetryFlow/withBackoffAndContext.md)
|
* [withBackoffAndContext](RetryFlow/withBackoffAndContext.md)
|
||||||
|
* [gzip](Compression/gzip.md)
|
||||||
|
* [deflate](Compression/deflate.md)
|
||||||
* [actorRef](ActorSource/actorRef.md)
|
* [actorRef](ActorSource/actorRef.md)
|
||||||
* [actorRefWithBackpressure](ActorSource/actorRefWithBackpressure.md)
|
* [actorRefWithBackpressure](ActorSource/actorRefWithBackpressure.md)
|
||||||
* [ask](ActorFlow/ask.md)
|
* [ask](ActorFlow/ask.md)
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
|
||||||
"Fan-out operators",
|
"Fan-out operators",
|
||||||
"Watching status operators",
|
"Watching status operators",
|
||||||
"Actor interop operators",
|
"Actor interop operators",
|
||||||
|
"Compression operators",
|
||||||
"Error handling")
|
"Error handling")
|
||||||
|
|
||||||
def categoryId(name: String): String = name.toLowerCase.replace(' ', '-')
|
def categoryId(name: String): String = name.toLowerCase.replace(' ', '-')
|
||||||
|
|
@ -98,7 +99,12 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
|
||||||
"actorSubscriber",
|
"actorSubscriber",
|
||||||
"foldAsync",
|
"foldAsync",
|
||||||
"newOnCompleteStage",
|
"newOnCompleteStage",
|
||||||
|
),
|
||||||
|
"Compression" -> Seq(
|
||||||
|
"inflate",
|
||||||
|
"gunzip",
|
||||||
)
|
)
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val ignore =
|
val ignore =
|
||||||
|
|
@ -151,6 +157,8 @@ object StreamOperatorsIndexGenerator extends AutoPlugin {
|
||||||
"akka-stream/src/main/scala/akka/stream/javadsl/RestartSink.scala",
|
"akka-stream/src/main/scala/akka/stream/javadsl/RestartSink.scala",
|
||||||
"akka-stream/src/main/scala/akka/stream/scaladsl/RetryFlow.scala",
|
"akka-stream/src/main/scala/akka/stream/scaladsl/RetryFlow.scala",
|
||||||
"akka-stream/src/main/scala/akka/stream/javadsl/RetryFlow.scala",
|
"akka-stream/src/main/scala/akka/stream/javadsl/RetryFlow.scala",
|
||||||
|
"akka-stream/src/main/scala/akka/stream/scaladsl/Compression.scala",
|
||||||
|
"akka-stream/src/main/scala/akka/stream/javadsl/Compression.scala",
|
||||||
// akka-stream-typed
|
// akka-stream-typed
|
||||||
"akka-stream-typed/src/main/scala/akka/stream/typed/javadsl/ActorSource.scala",
|
"akka-stream-typed/src/main/scala/akka/stream/typed/javadsl/ActorSource.scala",
|
||||||
"akka-stream-typed/src/main/scala/akka/stream/typed/scaladsl/ActorSource.scala",
|
"akka-stream-typed/src/main/scala/akka/stream/typed/scaladsl/ActorSource.scala",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue