aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-01-29 10:58:59 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2018-01-29 10:58:59 -0800
commitbdb746ec00fcea16981f26c90bce514baaec494c (patch)
treea0b5b861517c7b3fc190f9d43eeaeec6ed2c34e6 /include
parent804507d638f3bd0b2bcec1fcb2fd1cdbc361a90b (diff)
parent123547c9625c56fdf5cb4ddd1df55ae0c785fa60 (diff)
Merge branch 'master' of https://github.com/grpc/grpc into channel-tracing
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/impl/codegen/call.h21
-rw-r--r--include/grpc/compression.h35
-rw-r--r--include/grpc/compression_ruby.h48
-rw-r--r--include/grpc/impl/codegen/compression_types.h70
-rw-r--r--include/grpc/impl/codegen/grpc_types.h4
-rw-r--r--include/grpc/module.modulemap1
6 files changed, 66 insertions, 113 deletions
diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h
index e581049e7f..c04526c59b 100644
--- a/include/grpc++/impl/codegen/call.h
+++ b/include/grpc++/impl/codegen/call.h
@@ -216,14 +216,12 @@ class CallOpSendInitialMetadata {
public:
CallOpSendInitialMetadata() : send_(false) {
maybe_compression_level_.is_set = false;
- maybe_stream_compression_level_.is_set = false;
}
void SendInitialMetadata(
const std::multimap<grpc::string, grpc::string>& metadata,
uint32_t flags) {
maybe_compression_level_.is_set = false;
- maybe_stream_compression_level_.is_set = false;
send_ = true;
flags_ = flags;
initial_metadata_ =
@@ -235,11 +233,6 @@ class CallOpSendInitialMetadata {
maybe_compression_level_.level = level;
}
- void set_stream_compression_level(grpc_stream_compression_level level) {
- maybe_stream_compression_level_.is_set = true;
- maybe_stream_compression_level_.level = level;
- }
-
protected:
void AddOp(grpc_op* ops, size_t* nops) {
if (!send_) return;
@@ -255,12 +248,6 @@ class CallOpSendInitialMetadata {
op->data.send_initial_metadata.maybe_compression_level.level =
maybe_compression_level_.level;
}
- op->data.send_initial_metadata.maybe_stream_compression_level.is_set =
- maybe_stream_compression_level_.is_set;
- if (maybe_stream_compression_level_.is_set) {
- op->data.send_initial_metadata.maybe_stream_compression_level.level =
- maybe_stream_compression_level_.level;
- }
}
void FinishOp(bool* status) {
if (!send_) return;
@@ -276,10 +263,6 @@ class CallOpSendInitialMetadata {
bool is_set;
grpc_compression_level level;
} maybe_compression_level_;
- struct {
- bool is_set;
- grpc_stream_compression_level level;
- } maybe_stream_compression_level_;
};
class CallOpSendMessage {
@@ -624,7 +607,7 @@ class CallOpSetInterface : public CompletionQueueTag {
virtual void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) = 0;
};
-/// Primary implementaiton of CallOpSetInterface.
+/// Primary implementation of CallOpSetInterface.
/// Since we cannot use variadic templates, we declare slots up to
/// the maximum count of ops we'll need in a set. We leverage the
/// empty base class optimization to slim this class (especially
@@ -641,7 +624,7 @@ class CallOpSet : public CallOpSetInterface,
public Op5,
public Op6 {
public:
- CallOpSet() : return_tag_(this) {}
+ CallOpSet() : return_tag_(this), call_(nullptr) {}
void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) override {
this->Op1::AddOp(ops, nops);
this->Op2::AddOp(ops, nops);
diff --git a/include/grpc/compression.h b/include/grpc/compression.h
index b42f428d7d..a4f6a8faf2 100644
--- a/include/grpc/compression.h
+++ b/include/grpc/compression.h
@@ -30,42 +30,30 @@
extern "C" {
#endif
+/** Return if an algorithm is message compression algorithm. */
+GRPCAPI int grpc_compression_algorithm_is_message(
+ grpc_compression_algorithm algorithm);
+
+/** Return if an algorithm is stream compression algorithm. */
+GRPCAPI int grpc_compression_algorithm_is_stream(
+ grpc_compression_algorithm algorithm);
+
/** Parses the \a slice as a grpc_compression_algorithm instance and updating \a
* algorithm. Returns 1 upon success, 0 otherwise. */
GRPCAPI int grpc_compression_algorithm_parse(
grpc_slice value, grpc_compression_algorithm* algorithm);
-/** Parses the \a slice as a grpc_stream_compression_algorithm instance and
- * updating \a algorithm. Returns 1 upon success, 0 otherwise. */
-int grpc_stream_compression_algorithm_parse(
- grpc_slice name, grpc_stream_compression_algorithm* algorithm);
-
/** Updates \a name with the encoding name corresponding to a valid \a
* algorithm. Note that \a name is statically allocated and must *not* be freed.
* Returns 1 upon success, 0 otherwise. */
GRPCAPI int grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm, const char** name);
-/** Updates \a name with the encoding name corresponding to a valid \a
- * algorithm. Note that \a name is statically allocated and must *not* be freed.
- * Returns 1 upon success, 0 otherwise. */
-GRPCAPI int grpc_stream_compression_algorithm_name(
- grpc_stream_compression_algorithm algorithm, const char** name);
-
/** Returns the compression algorithm corresponding to \a level for the
- * compression algorithms encoded in the \a accepted_encodings bitset.
- *
- * It abort()s for unknown levels. */
+ * compression algorithms encoded in the \a accepted_encodings bitset.*/
GRPCAPI grpc_compression_algorithm grpc_compression_algorithm_for_level(
grpc_compression_level level, uint32_t accepted_encodings);
-/** Returns the stream compression algorithm corresponding to \a level for the
- * compression algorithms encoded in the \a accepted_stream_encodings bitset.
- * It abort()s for unknown levels. */
-GRPCAPI grpc_stream_compression_algorithm
-grpc_stream_compression_algorithm_for_level(grpc_stream_compression_level level,
- uint32_t accepted_stream_encodings);
-
GRPCAPI void grpc_compression_options_init(grpc_compression_options* opts);
/** Mark \a algorithm as enabled in \a opts. */
@@ -80,11 +68,6 @@ GRPCAPI void grpc_compression_options_disable_algorithm(
GRPCAPI int grpc_compression_options_is_algorithm_enabled(
const 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_stream_compression_algorithm_enabled(
- const grpc_compression_options* opts,
- grpc_stream_compression_algorithm algorithm);
-
#ifdef __cplusplus
}
#endif
diff --git a/include/grpc/compression_ruby.h b/include/grpc/compression_ruby.h
new file mode 100644
index 0000000000..b063b2b529
--- /dev/null
+++ b/include/grpc/compression_ruby.h
@@ -0,0 +1,48 @@
+/*
+ *
+ * Copyright 2017 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_COMPRESSION_RUBY_H
+#define GRPC_COMPRESSION_RUBY_H
+
+#include <grpc/impl/codegen/port_platform.h>
+
+#include <grpc/impl/codegen/compression_types.h>
+#include <grpc/slice.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Parses the \a slice as a grpc_compression_algorithm instance and updating \a
+ * algorithm following algorithm names compatible with Ruby. Returns 1 upon
+ * success, 0 otherwise. */
+GRPCAPI int grpc_compression_algorithm_parse_ruby(
+ grpc_slice value, grpc_compression_algorithm* algorithm);
+
+/** Updates \a name with the encoding name corresponding to a valid \a
+ * algorithm. The \a name follows names compatible with Ruby. Note that \a name
+ * is statically allocated and must *not* be freed. Returns 1 upon success, 0
+ * otherwise. */
+GRPCAPI int grpc_compression_algorithm_name_ruby(
+ grpc_compression_algorithm algorithm, const char** name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_COMPRESSION_RUBY_H */
diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h
index 4419e2a447..ddc667fcdb 100644
--- a/include/grpc/impl/codegen/compression_types.h
+++ b/include/grpc/impl/codegen/compression_types.h
@@ -29,11 +29,6 @@ extern "C" {
* algorithm */
#define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
"grpc-internal-encoding-request"
-/** To be used as initial metadata key for the request of a concrete stream
- * compression
- * algorithm */
-#define GRPC_STREAM_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
- "grpc-internal-stream-encoding-request"
/** To be used in channel arguments.
*
@@ -43,17 +38,9 @@ extern "C" {
* Its value is an int from the \a grpc_compression_algorithm enum. */
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
"grpc.default_compression_algorithm"
-/** Default stream compression algorithm for the channel.
- * Its value is an int from the \a grpc_stream_compression_algorithm enum. */
-#define GRPC_STREAM_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
- "grpc.default_stream_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"
-/** Default stream compression level for the channel.
- * Its value is an int from the \a grpc_stream_compression_level enum. */
-#define GRPC_STREAM_COMPRESSION_CHANNEL_DEFAULT_LEVEL \
- "grpc.default_stream_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
@@ -63,33 +50,18 @@ extern "C" {
* be ignored). */
#define GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
"grpc.compression_enabled_algorithms_bitset"
-/** Stream compression algorithms supported by the channel.
- * Its value is a bitset (an int). Bits correspond to algorithms in \a
- * grpc_stream_compression_algorithm. For example, its LSB corresponds to
- * GRPC_STREAM_COMPRESS_NONE, the next bit to GRPC_STREAM_COMPRESS_DEFLATE, etc.
- * Unset bits disable support for the algorithm. By default all algorithms are
- * supported. It's not possible to disable GRPC_STREAM_COMPRESS_NONE (the
- * attempt will be ignored). */
-#define GRPC_STREAM_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET \
- "grpc.stream_compression_enabled_algorithms_bitset"
/** \} */
/** The various compression algorithms supported by gRPC */
typedef enum {
GRPC_COMPRESS_NONE = 0,
- GRPC_COMPRESS_DEFLATE,
- GRPC_COMPRESS_GZIP,
+ GRPC_COMPRESS_MESSAGE_DEFLATE,
+ GRPC_COMPRESS_MESSAGE_GZIP,
+ GRPC_COMPRESS_STREAM_GZIP,
/* TODO(ctiller): snappy */
GRPC_COMPRESS_ALGORITHMS_COUNT
} grpc_compression_algorithm;
-/** Stream compresssion algorithms supported by gRPC */
-typedef enum {
- GRPC_STREAM_COMPRESS_NONE = 0,
- GRPC_STREAM_COMPRESS_GZIP,
- GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT
-} grpc_stream_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
@@ -102,41 +74,22 @@ typedef enum {
GRPC_COMPRESS_LEVEL_COUNT
} grpc_compression_level;
-/** Compression levels for stream compression algorithms */
-typedef enum {
- GRPC_STREAM_COMPRESS_LEVEL_NONE = 0,
- GRPC_STREAM_COMPRESS_LEVEL_LOW,
- GRPC_STREAM_COMPRESS_LEVEL_MED,
- GRPC_STREAM_COMPRESS_LEVEL_HIGH,
- GRPC_STREAM_COMPRESS_LEVEL_COUNT
-} grpc_stream_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;
- uint32_t enabled_stream_compression_algorithms_bitset;
- /** The default message-wise compression level. It'll be used in the absence
- * of * call specific settings. This option corresponds to the channel
+ /** 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 and \a
- * default_stream_compression_algorithm.
+ * 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 stream compression level. It'll be used in the absence of call
- * specefic settings. If present, takes precedence over \a default_level,
- * \a default_algorithm and \a default_stream_compression_algorithm. */
- struct grpc_stream_compression_options_default_level {
- int is_set;
- grpc_stream_compression_level level;
- } default_stream_compression_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. */
@@ -144,17 +97,6 @@ typedef struct grpc_compression_options {
int is_set;
grpc_compression_algorithm algorithm;
} default_algorithm;
-
- /** The default stream compression algorithm. It'll be used in the absence of
- * call specific settings. If present, takes precedence over \a
- * default_algorithm. This option corresponds to the channel
- * argument key behind \a GRPC_STREAM_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM.
- */
- struct grpc_stream_compression_options_default_algorithm {
- int is_set;
- grpc_stream_compression_algorithm algorithm;
- } default_stream_compression_algorithm;
-
} grpc_compression_options;
#ifdef __cplusplus
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index 82eb931799..e3af64b3c0 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -518,10 +518,6 @@ typedef struct grpc_op {
uint8_t is_set;
grpc_compression_level level;
} maybe_compression_level;
- struct grpc_op_send_initial_metadata_maybe_stream_compression_level {
- uint8_t is_set;
- grpc_stream_compression_level level;
- } maybe_stream_compression_level;
} send_initial_metadata;
struct grpc_op_send_message {
/** This op takes ownership of the slices in send_message. After
diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap
index da95515d8e..d23072f556 100644
--- a/include/grpc/module.modulemap
+++ b/include/grpc/module.modulemap
@@ -45,6 +45,7 @@ framework module grpc {
header "byte_buffer.h"
header "byte_buffer_reader.h"
header "compression.h"
+ header "compression_ruby.h"
header "fork.h"
header "grpc.h"
header "grpc_posix.h"