aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-05-17 23:24:39 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-05-17 23:24:39 -0700
commit2d02456e785053735172186868300d0f4dde3d9e (patch)
tree1462db11939dfebac89bf2e594dc29b98d3bcfc6 /include
parente825df736ae3681270e9cde4b8ccc07b70205516 (diff)
got rid of grpc_compression_options
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/server_builder.h48
-rw-r--r--include/grpc/compression.h14
-rw-r--r--include/grpc/impl/codegen/compression_types.h26
3 files changed, 35 insertions, 53 deletions
diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h
index ad629521cb..c48c86d2b8 100644
--- a/include/grpc++/server_builder.h
+++ b/include/grpc++/server_builder.h
@@ -66,29 +66,43 @@ class ServerBuilder {
/// The service must exist for the lifetime of the \a Server instance returned
/// by \a BuildAndStart().
/// Matches requests with any :authority
- void RegisterService(Service* service);
+ ServerBuilder& RegisterService(Service* service);
/// Register a generic service.
/// Matches requests with any :authority
- void RegisterAsyncGenericService(AsyncGenericService* service);
+ ServerBuilder& RegisterAsyncGenericService(AsyncGenericService* service);
/// Register a service. This call does not take ownership of the service.
/// The service must exist for the lifetime of the \a Server instance returned
/// by BuildAndStart().
/// Only matches requests with :authority \a host
- void RegisterService(const grpc::string& host, Service* service);
+ ServerBuilder& RegisterService(const grpc::string& host, Service* service);
/// Set max message size in bytes.
- void SetMaxMessageSize(int max_message_size) {
+ ServerBuilder& SetMaxMessageSize(int max_message_size) {
max_message_size_ = max_message_size;
+ return *this;
}
- /// Set the compression options to be used by the server.
- void SetCompressionOptions(const grpc_compression_options& options) {
- compression_options_ = options;
- }
+ /// Set the support status for compression algorithms. All algorithms are
+ /// enabled by default.
+ ///
+ /// Incoming calls compressed with an unsupported algorithm will fail with
+ /// GRPC_STATUS_UNIMPLEMENTED.
+ ServerBuilder& SetCompressionAlgorithmSupportStatus(
+ grpc_compression_algorithm algorithm, bool enabled);
+
+ /// The default compression level to use for all channel calls in the
+ /// absence of a call-specific level.
+ ServerBuilder& SetDefaultCompressionLevel(grpc_compression_level level);
+
+ /// The default compression algorithm to use for all channel calls in the
+ /// absence of a call-specific level. Note that it overrides any compression
+ /// level set by \a SetDefaultCompressionLevel.
+ ServerBuilder& SetDefaultCompressionAlgorithm(
+ grpc_compression_algorithm algorithm);
- void SetOption(std::unique_ptr<ServerBuilderOption> option);
+ ServerBuilder& SetOption(std::unique_ptr<ServerBuilderOption> option);
/// Tries to bind \a server to the given \a addr.
///
@@ -101,9 +115,9 @@ class ServerBuilder {
/// number. \a nullptr otherwise.
///
// TODO(dgq): the "port" part seems to be a misnomer.
- void AddListeningPort(const grpc::string& addr,
- std::shared_ptr<ServerCredentials> creds,
- int* selected_port = nullptr);
+ ServerBuilder& AddListeningPort(const grpc::string& addr,
+ std::shared_ptr<ServerCredentials> creds,
+ int* selected_port = nullptr);
/// Add a completion queue for handling asynchronous services
/// Caller is required to keep this completion queue live until
@@ -136,7 +150,6 @@ class ServerBuilder {
};
int max_message_size_;
- grpc_compression_options compression_options_;
std::vector<std::unique_ptr<ServerBuilderOption>> options_;
std::vector<std::unique_ptr<NamedService>> services_;
std::vector<Port> ports_;
@@ -144,6 +157,15 @@ class ServerBuilder {
std::shared_ptr<ServerCredentials> creds_;
std::map<grpc::string, std::unique_ptr<ServerBuilderPlugin>> plugins_;
AsyncGenericService* generic_service_;
+ struct {
+ bool is_set;
+ grpc_compression_level level;
+ } maybe_default_compression_level_;
+ struct {
+ bool is_set;
+ grpc_compression_algorithm algorithm;
+ } maybe_default_compression_algorithm_;
+ uint32_t enabled_compression_algorithms_bitset_;
};
} // namespace grpc
diff --git a/include/grpc/compression.h b/include/grpc/compression.h
index 04816b9f3a..3eba00c986 100644
--- a/include/grpc/compression.h
+++ b/include/grpc/compression.h
@@ -55,20 +55,6 @@ GRPCAPI int grpc_compression_algorithm_parse(
GRPCAPI int grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm, char **name);
-GRPCAPI void grpc_compression_options_init(grpc_compression_options *opts);
-
-/** Mark \a algorithm as enabled in \a opts. */
-GRPCAPI void grpc_compression_options_enable_algorithm(
- grpc_compression_options *opts, grpc_compression_algorithm algorithm);
-
-/** Mark \a algorithm as disabled in \a opts. */
-GRPCAPI void grpc_compression_options_disable_algorithm(
- grpc_compression_options *opts, grpc_compression_algorithm algorithm);
-
-/** Returns true if \a algorithm is marked as enabled in \a opts. */
-GRPCAPI int grpc_compression_options_is_algorithm_enabled(
- const grpc_compression_options *opts, grpc_compression_algorithm algorithm);
-
#ifdef __cplusplus
}
#endif
diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h
index 7cf68bfaf8..19c2cefcf4 100644
--- a/include/grpc/impl/codegen/compression_types.h
+++ b/include/grpc/impl/codegen/compression_types.h
@@ -74,32 +74,6 @@ typedef enum {
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 channel 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 {
- bool is_set;
- grpc_compression_algorithm level;
- } default_level;
-
- /** The default channel 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 {
- bool is_set;
- grpc_compression_algorithm algorithm;
- } default_algorithm;
-
-} grpc_compression_options;
-
#ifdef __cplusplus
}
#endif