aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-06-17 17:21:09 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-06-17 17:21:09 -0700
commit4ec433741a0b163dd8d6ccf8452ebd37d3e16245 (patch)
tree72b78e5ce8e8ba1808b7da095857058a7184b7a0 /include
parent22a7cdffc444fbda6c8967ee75c49487e0501600 (diff)
parentccb20bb98ccf35ef1e3398dfd762abcf1dec6bb1 (diff)
Merge pull request #2071 from dgquintas/compression-levels
Introduced compression levels as an abstraction for the actual algorithm
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/channel_arguments.h4
-rw-r--r--include/grpc/compression.h13
2 files changed, 17 insertions, 0 deletions
diff --git a/include/grpc++/channel_arguments.h b/include/grpc++/channel_arguments.h
index 8d338c654e..68f24cde4a 100644
--- a/include/grpc++/channel_arguments.h
+++ b/include/grpc++/channel_arguments.h
@@ -38,6 +38,7 @@
#include <list>
#include <grpc++/config.h>
+#include <grpc/compression.h>
#include <grpc/grpc.h>
namespace grpc {
@@ -58,6 +59,9 @@ class ChannelArguments {
void SetSslTargetNameOverride(const grpc::string& name);
// TODO(yangg) add flow control options
+ // Set the compression level for the channel.
+ void SetCompressionLevel(grpc_compression_level level);
+
// Generic channel argument setters. Only for advanced use cases.
void SetInt(const grpc::string& key, int value);
void SetString(const grpc::string& key, const grpc::string& value);
diff --git a/include/grpc/compression.h b/include/grpc/compression.h
index 630fa1656a..207898f605 100644
--- a/include/grpc/compression.h
+++ b/include/grpc/compression.h
@@ -34,6 +34,9 @@
#ifndef GRPC_COMPRESSION_H
#define GRPC_COMPRESSION_H
+/** To be used in channel arguments */
+#define GRPC_COMPRESSION_LEVEL_ARG "grpc.compression_level"
+
/* The various compression algorithms supported by GRPC */
typedef enum {
GRPC_COMPRESS_NONE = 0,
@@ -43,7 +46,17 @@ typedef enum {
GRPC_COMPRESS_ALGORITHMS_COUNT
} grpc_compression_algorithm;
+typedef enum {
+ GRPC_COMPRESS_LEVEL_NONE = 0,
+ GRPC_COMPRESS_LEVEL_LOW,
+ GRPC_COMPRESS_LEVEL_MED,
+ GRPC_COMPRESS_LEVEL_HIGH
+} grpc_compression_level;
+
const char *grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm);
+grpc_compression_algorithm grpc_compression_algorithm_for_level(
+ grpc_compression_level level);
+
#endif /* GRPC_COMPRESSION_H */