Skip to content

Commit

Permalink
Remove include/grpc/impl/codegen/compression_types.h (grpc#31726)
Browse files Browse the repository at this point in the history
* Remove `include/grpc/impl/codegen/compression_types.h`

* Automated change: Fix sanity tests
  • Loading branch information
ralphchung authored Nov 22, 2022
1 parent 5fb4c23 commit c34d99f
Show file tree
Hide file tree
Showing 36 changed files with 151 additions and 103 deletions.
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ GRPC_PUBLIC_HDRS = [
"include/grpc/impl/codegen/propagation_bits.h",
"include/grpc/impl/codegen/status.h",
"include/grpc/impl/codegen/slice.h",
"include/grpc/impl/compression_types.h",
]

GRPC_PUBLIC_EVENT_ENGINE_HDRS = [
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions build_autogenerated.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gRPC-Core.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions grpc.gemspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion include/grpc/compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <stdlib.h>

#include <grpc/impl/codegen/compression_types.h> // IWYU pragma: export
#include <grpc/impl/compression_types.h> // IWYU pragma: export
#include <grpc/slice.h>

#ifdef __cplusplus
Expand Down
85 changes: 3 additions & 82 deletions include/grpc/impl/codegen/compression_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,88 +22,9 @@
// IWYU pragma: private, include <grpc/compression.h>
// IWYU pragma: friend "src/.*"

#include <grpc/impl/codegen/port_platform.h>
#include <grpc/support/port_platform.h>

#ifdef __cplusplus
extern "C" {
#endif

/** To be used as initial metadata key for the request of a concrete compression
* algorithm */
#define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
"grpc-internal-encoding-request"

/** To be used in channel arguments.
*
* \addtogroup grpc_arg_keys
* \{ */
/** Default compression algorithm for the channel.
* Its value is an int from the \a grpc_compression_algorithm enum. */
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
"grpc.default_compression_algorithm"
/** Default compression level for the channel.
* Its value is an int from the \a grpc_compression_level enum. */
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL "grpc.default_compression_level"
/** Compression algorithms supported by the channel.
* Its value is a bitset (an int). Bits correspond to algorithms in \a
* grpc_compression_algorithm. For example, its LSB corresponds to
* GRPC_COMPRESS_NONE, the next bit to GRPC_COMPRESS_DEFLATE, etc.
* Unset bits disable support for the algorithm. By default all algorithms are
* supported. It's not possible to disable GRPC_COMPRESS_NONE (the attempt will
* be ignored). */
#define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
"grpc.compression_enabled_algorithms_bitset"
/** \} */

/** The various compression algorithms supported by gRPC (not sorted by
* compression level) */
typedef enum {
GRPC_COMPRESS_NONE = 0,
GRPC_COMPRESS_DEFLATE,
GRPC_COMPRESS_GZIP,
/* TODO(ctiller): snappy */
GRPC_COMPRESS_ALGORITHMS_COUNT
} grpc_compression_algorithm;

/** Compression levels allow a party with knowledge of its peer's accepted
* encodings to request compression in an abstract way. The level-algorithm
* mapping is performed internally and depends on the peer's supported
* compression algorithms. */
typedef enum {
GRPC_COMPRESS_LEVEL_NONE = 0,
GRPC_COMPRESS_LEVEL_LOW,
GRPC_COMPRESS_LEVEL_MED,
GRPC_COMPRESS_LEVEL_HIGH,
GRPC_COMPRESS_LEVEL_COUNT
} grpc_compression_level;

typedef struct grpc_compression_options {
/** All algs are enabled by default. This option corresponds to the channel
* argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
*/
uint32_t enabled_algorithms_bitset;

/** The default compression level. It'll be used in the absence of call
* specific settings. This option corresponds to the channel
* argument key behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present,
* takes precedence over \a default_algorithm.
* TODO(dgq): currently only available for server channels. */
struct grpc_compression_options_default_level {
int is_set;
grpc_compression_level level;
} default_level;

/** The default message compression algorithm. It'll be used in the absence of
* call specific settings. This option corresponds to the channel argument key
* behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
struct grpc_compression_options_default_algorithm {
int is_set;
grpc_compression_algorithm algorithm;
} default_algorithm;
} grpc_compression_options;

#ifdef __cplusplus
}
#endif
/// TODO(chengyuc): Remove this file after solving compatibility.
#include <grpc/impl/compression_types.h>

#endif /* GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H */
109 changes: 109 additions & 0 deletions include/grpc/impl/compression_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
*
* Copyright 2016 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#ifndef GRPC_IMPL_COMPRESSION_TYPES_H
#define GRPC_IMPL_COMPRESSION_TYPES_H

// IWYU pragma: private, include <grpc/compression.h>
// IWYU pragma: friend "src/.*"

#include <grpc/support/port_platform.h>

#ifdef __cplusplus
extern "C" {
#endif

/** To be used as initial metadata key for the request of a concrete compression
* algorithm */
#define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
"grpc-internal-encoding-request"

/** To be used in channel arguments.
*
* \addtogroup grpc_arg_keys
* \{ */
/** Default compression algorithm for the channel.
* Its value is an int from the \a grpc_compression_algorithm enum. */
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
"grpc.default_compression_algorithm"
/** Default compression level for the channel.
* Its value is an int from the \a grpc_compression_level enum. */
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL "grpc.default_compression_level"
/** Compression algorithms supported by the channel.
* Its value is a bitset (an int). Bits correspond to algorithms in \a
* grpc_compression_algorithm. For example, its LSB corresponds to
* GRPC_COMPRESS_NONE, the next bit to GRPC_COMPRESS_DEFLATE, etc.
* Unset bits disable support for the algorithm. By default all algorithms are
* supported. It's not possible to disable GRPC_COMPRESS_NONE (the attempt will
* be ignored). */
#define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
"grpc.compression_enabled_algorithms_bitset"
/** \} */

/** The various compression algorithms supported by gRPC (not sorted by
* compression level) */
typedef enum {
GRPC_COMPRESS_NONE = 0,
GRPC_COMPRESS_DEFLATE,
GRPC_COMPRESS_GZIP,
/* TODO(ctiller): snappy */
GRPC_COMPRESS_ALGORITHMS_COUNT
} grpc_compression_algorithm;

/** Compression levels allow a party with knowledge of its peer's accepted
* encodings to request compression in an abstract way. The level-algorithm
* mapping is performed internally and depends on the peer's supported
* compression algorithms. */
typedef enum {
GRPC_COMPRESS_LEVEL_NONE = 0,
GRPC_COMPRESS_LEVEL_LOW,
GRPC_COMPRESS_LEVEL_MED,
GRPC_COMPRESS_LEVEL_HIGH,
GRPC_COMPRESS_LEVEL_COUNT
} grpc_compression_level;

typedef struct grpc_compression_options {
/** All algs are enabled by default. This option corresponds to the channel
* argument key behind \a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET
*/
uint32_t enabled_algorithms_bitset;

/** The default compression level. It'll be used in the absence of call
* specific settings. This option corresponds to the channel
* argument key behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present,
* takes precedence over \a default_algorithm.
* TODO(dgq): currently only available for server channels. */
struct grpc_compression_options_default_level {
int is_set;
grpc_compression_level level;
} default_level;

/** The default message compression algorithm. It'll be used in the absence of
* call specific settings. This option corresponds to the channel argument key
* behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
struct grpc_compression_options_default_algorithm {
int is_set;
grpc_compression_algorithm algorithm;
} default_algorithm;
} grpc_compression_options;

#ifdef __cplusplus
}
#endif

#endif /* GRPC_IMPL_COMPRESSION_TYPES_H */
1 change: 1 addition & 0 deletions include/grpc/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ header "byte_buffer.h"
header "impl/codegen/sync.h"
header "impl/codegen/sync_abseil.h"
header "impl/codegen/sync_generic.h"
header "impl/compression_types.h"
header "load_reporting.h"
header "slice.h"
header "slice_buffer.h"
Expand Down
2 changes: 1 addition & 1 deletion include/grpcpp/client_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include <memory>
#include <string>

#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/propagation_bits.h>
#include <grpc/impl/compression_types.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/create_auth_context.h>
#include <grpcpp/impl/metadata_map.h>
Expand Down
2 changes: 1 addition & 1 deletion include/grpcpp/impl/call_op_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <map>
#include <memory>

#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/compression_types.h>
#include <grpc/support/log.h>
#include <grpcpp/client_context.h>
#include <grpcpp/completion_queue.h>
Expand Down
2 changes: 1 addition & 1 deletion include/grpcpp/server_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <type_traits>
#include <vector>

#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/compression_types.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set.h>
#include <grpcpp/impl/codegen/create_auth_context.h>
Expand Down
1 change: 1 addition & 0 deletions package.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include "absl/types/optional.h"

#include <grpc/compression.h>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/compression_types.h>
#include <grpc/support/log.h>

#include "src/core/ext/filters/message_size/message_size_filter.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "absl/status/statusor.h"
#include "absl/types/optional.h"

#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/compression_types.h>

#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_fwd.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/ext/transport/chttp2/transport/hpack_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"

#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/compression_types.h>
#include <grpc/slice.h>
#include <grpc/status.h>

Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/compression/compression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "absl/types/optional.h"

#include <grpc/compression.h>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/compression_types.h>
#include <grpc/slice.h>

#include "src/core/lib/compression/compression_internal.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/compression/compression_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"

#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/compression_types.h>

#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/bitset.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/compression/message_compress.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <grpc/support/port_platform.h>

#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/compression_types.h>
#include <grpc/slice.h>

/* compress 'input' to 'output' using 'algorithm'.
Expand Down
Loading

0 comments on commit c34d99f

Please sign in to comment.