Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core,stub: Document grpc performs compression nego on server #5401

Merged
merged 2 commits into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/src/main/java/io/grpc/ServerCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ public void setMessageCompression(boolean enabled) {
* The compressor to use will be looked up in the {@link CompressorRegistry}. Default gRPC
* servers support the "gzip" compressor.
*
* <p>It is safe to call this even if the client does not support the compression format chosen.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: you might call out that the analogous client side call (CallOptions.withCompression) does not safely negotiate.

* The implementation will handle negotiation with the client and may fall back to no compression.
*
* @param compressor the name of the compressor to use.
* @throws IllegalArgumentException if the compressor name can not be found.
*/
Expand Down
8 changes: 6 additions & 2 deletions stub/src/main/java/io/grpc/stub/ServerCallStreamObserver.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ public abstract class ServerCallStreamObserver<V> extends CallStreamObserver<V>
public abstract void setOnCancelHandler(Runnable onCancelHandler);

/**
* Sets the compression algorithm to use for the call. May only be called before sending any
* messages.
* Sets the compression algorithm to use for the call. May only be called before sending any
* messages. Default gRPC servers support the "gzip" compressor.
*
* <p>It is safe to call this even if the client does not support the compression format chosen.
* The implementation will handle negotiation with the client and may fall back to no compression.
*
* @param compression the compression algorithm to use.
* @throws IllegalArgumentException if the compressor name can not be found.
*/
public abstract void setCompression(String compression);
}