Skip to content

Commit

Permalink
api,stub:Stabilize part of compression agreed to in the stabilization…
Browse files Browse the repository at this point in the history
… meeting.

addresses part of grpc#1704
  • Loading branch information
larry-safran committed Mar 6, 2023
1 parent 4b6853b commit a792c7e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
4 changes: 1 addition & 3 deletions api/src/main/java/io/grpc/CallOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,12 @@ public CallOptions withCallCredentials(@Nullable CallCredentials credentials) {

/**
* Sets the compression to use for the call. The compressor must be a valid name known in the
* {@link CompressorRegistry}.
* {@link CompressorRegistry}. By default, the "gzip" compressor will be available.
*
* <p>It is only safe to call this if the server supports the compression format chosen. There is
* no negotiation performed; if the server does not support the compression chosen, the call will
* fail.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
public CallOptions withCompression(@Nullable String compressorName) {
Builder builder = toBuilder(this);
builder.compressorName = compressorName;
Expand Down Expand Up @@ -207,7 +206,6 @@ public CallOptions withoutWaitForReady() {
/**
* Returns the compressor's name.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
@Nullable
public String getCompressor() {
return compressorName;
Expand Down
2 changes: 0 additions & 2 deletions api/src/main/java/io/grpc/ServerCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ public boolean isReady() {
* encoding has been negotiated, this is a no-op. By default per-message compression is enabled,
* but may not have any effect if compression is not enabled on the call.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
public void setMessageCompression(boolean enabled) {
// noop
}
Expand All @@ -206,7 +205,6 @@ public void setMessageCompression(boolean enabled) {
* @param compressor the name of the compressor to use.
* @throws IllegalArgumentException if the compressor name can not be found.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
public void setCompression(String compressor) {
// noop
}
Expand Down
5 changes: 1 addition & 4 deletions stub/src/main/java/io/grpc/stub/AbstractStub.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,11 @@ public final S withExecutor(Executor executor) {
/**
* Set's the compressor name to use for the call. It is the responsibility of the application
* to make sure the server supports decoding the compressor picked by the client. To be clear,
* this is the compressor used by the stub to compress messages to the server. To get
* compressed responses from the server, set the appropriate {@link io.grpc.DecompressorRegistry}
* on the {@link io.grpc.ManagedChannelBuilder}.
* this is the compressor used by the stub to compress messages to the server.
*
* @since 1.0.0
* @param compressorName the name (e.g. "gzip") of the compressor to use.
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
public final S withCompression(String compressorName) {
return build(channel, callOptions.withCompression(compressorName));
}
Expand Down

0 comments on commit a792c7e

Please sign in to comment.