Sorry wrong flag posted. C++ actual flag in client is 
"GRPC_COMPRESS_STREAM_GZIP".

Thanks,
Parth

On Thursday, June 25, 2020 at 6:32:19 PM UTC+5:30, [email protected] wrote:
>
> HI,
>
> grpc-core supports "GRPC_COMPRESS_GZIP" flag to provide full stream level 
> gzip compression.
>
> In grpc-java we have gzip inflater is already implemented. This was used 
> and client side support for full-stream decompression is already 
> implemented (#3403 <https://github.com/grpc/grpc-java/pull/3403>). 
>
> I am looking for server side capabilities in grpc-java which can support 
> full-stream decompression. 
> Currently we are doing this by patch on ServerImpl.java for checking 
> "Content-Encoding" header and  setting GzipInflatingBuffer on 
> AbstractServerStream.
>
> @@ -21,6 +21,7 @@
>  import static 
> com.google.common.util.concurrent.MoreExecutors.directExecutor;
>  import static io.grpc.Contexts.statusFromCancelled;
>  import static io.grpc.Status.DEADLINE_EXCEEDED;
> +import static io.grpc.internal.GrpcUtil.CONTENT_ENCODING_KEY;
>  import static io.grpc.internal.GrpcUtil.MESSAGE_ENCODING_KEY;
>  import static io.grpc.internal.GrpcUtil.TIMEOUT_KEY;
>  import static java.util.concurrent.TimeUnit.NANOSECONDS;
> @@ -52,6 +53,7 @@
>  import io.grpc.ServerServiceDefinition;
>  import io.grpc.ServerTransportFilter;
>  import io.grpc.Status;
> +import io.grpc.internal.AbstractServerStream;
>  import io.perfmark.Link;
>  import io.perfmark.PerfMark;
>  import io.perfmark.Tag;
> @@ -494,6 +496,14 @@
>          }
>          stream.setDecompressor(decompressor);
>        }
> +      
> +      if (headers.containsKey(CONTENT_ENCODING_KEY)) {
> +        String streamEncoding = headers.get(CONTENT_ENCODING_KEY);
> +        if (streamEncoding.equalsIgnoreCase("gzip") && stream instanceof 
> AbstractServerStream) {
> +          ((AbstractServerStream)stream).transportState()
> +            .setFullStreamDecompressor(new GzipInflatingBuffer());
> +        }
> +      }
>  
>        final StatsTraceContext statsTraceCtx = Preconditions.checkNotNull(
>            stream.statsTraceContext(), "statsTraceCtx not present from 
> stream");
> @@ -554,14 +564,10 @@
>
>
>
> Is there any other way to achieve similar thing without patch?
> If it can not be achieved without patch can we submit a ticket and patch 
> for grpc-java project?
>
> Thanks,
> Parth
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/68c2d7bc-98d9-4c43-91b6-f972e8413d17o%40googlegroups.com.

Reply via email to