diff options
author | 2015-06-19 15:32:52 -0700 | |
---|---|---|
committer | 2015-06-19 15:32:52 -0700 | |
commit | ab67485ff03505bcf558c0f1ebd3e2338b00ce59 (patch) | |
tree | 547d9d86c6044bd38151bb3e7b1e9effa7f4f200 /include | |
parent | 2622ddbcfd126fe78b46b4252157479cb1d11669 (diff) | |
parent | f3fac562e8994631484f77ad8b0c6c17582699a8 (diff) |
Merge github.com:grpc/grpc into one-shouldnt-depend-on-protobufs
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/channel_arguments.h | 4 | ||||
-rw-r--r-- | include/grpc/byte_buffer.h | 3 | ||||
-rw-r--r-- | include/grpc/byte_buffer_reader.h | 2 | ||||
-rw-r--r-- | include/grpc/compression.h | 15 | ||||
-rw-r--r-- | include/grpc/grpc.h | 22 | ||||
-rw-r--r-- | include/grpc/grpc_security.h | 5 | ||||
-rw-r--r-- | include/grpc/support/slice.h | 2 | ||||
-rw-r--r-- | include/grpc/support/tls_pthread.h | 5 |
8 files changed, 39 insertions, 19 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/byte_buffer.h b/include/grpc/byte_buffer.h index 6d08474d8c..a62054ac19 100644 --- a/include/grpc/byte_buffer.h +++ b/include/grpc/byte_buffer.h @@ -85,7 +85,6 @@ size_t grpc_byte_buffer_length(grpc_byte_buffer *bb); /** Destroys \a byte_buffer deallocating all its memory. */ void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer); - /** Reader for byte buffers. Iterates over slices in the byte buffer */ struct grpc_byte_buffer_reader; typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader; @@ -107,4 +106,4 @@ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader, } #endif -#endif /* GRPC_BYTE_BUFFER_H */ +#endif /* GRPC_BYTE_BUFFER_H */ diff --git a/include/grpc/byte_buffer_reader.h b/include/grpc/byte_buffer_reader.h index 1ef817cf30..b0e63a6da2 100644 --- a/include/grpc/byte_buffer_reader.h +++ b/include/grpc/byte_buffer_reader.h @@ -55,4 +55,4 @@ struct grpc_byte_buffer_reader { } #endif -#endif /* GRPC_BYTE_BUFFER_READER_H */ +#endif /* GRPC_BYTE_BUFFER_READER_H */ diff --git a/include/grpc/compression.h b/include/grpc/compression.h index 630fa1656a..61bce05b50 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); -#endif /* GRPC_COMPRESSION_H */ +grpc_compression_algorithm grpc_compression_algorithm_for_level( + grpc_compression_level level); + +#endif /* GRPC_COMPRESSION_H */ diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index b360725f6b..9272673cab 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -99,7 +99,8 @@ typedef struct { These configuration options are modelled as key-value pairs as defined by grpc_arg; keys are strings to allow easy backwards-compatible extension by arbitrary parties. - All evaluation is performed at channel creation time. */ + All evaluation is performed at channel creation time (i.e. the values in + this structure need only live through the creation invocation). */ typedef struct { size_t num_args; grpc_arg *args; @@ -255,7 +256,7 @@ typedef enum { no arguments) */ typedef struct grpc_op { grpc_op_type op; - gpr_uint32 flags; /**< Write flags bitset for grpc_begin_messages */ + gpr_uint32 flags; /**< Write flags bitset for grpc_begin_messages */ union { struct { size_t count; @@ -274,6 +275,8 @@ typedef struct grpc_op { After the operation completes, call grpc_metadata_array_destroy on this value, or reuse it in a future op. */ grpc_metadata_array *recv_initial_metadata; + /* ownership of the byte buffer is moved to the caller; the caller must call + grpc_byte_buffer_destroy on this value, or reuse it in a future op. */ grpc_byte_buffer **recv_message; struct { /* ownership of the array is with the caller, but ownership of the @@ -374,7 +377,8 @@ void grpc_completion_queue_destroy(grpc_completion_queue *cq); /* Create a call given a grpc_channel, in order to call 'method'. The request is not sent until grpc_call_invoke is called. All completions are sent to - 'completion_queue'. */ + 'completion_queue'. 'method' and 'host' need only live through the invocation + of this function. */ grpc_call *grpc_channel_create_call(grpc_channel *channel, grpc_completion_queue *completion_queue, const char *method, const char *host, @@ -399,8 +403,9 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, /* Create a client channel to 'target'. Additional channel level configuration MAY be provided by grpc_channel_args, though the expectation is that most - clients will want to simply pass NULL. See grpc_channel_args definition - for more on this. */ + clients will want to simply pass NULL. See grpc_channel_args definition for + more on this. The data in 'args' need only live through the invocation of + this function. */ grpc_channel *grpc_channel_create(const char *target, const grpc_channel_args *args); @@ -471,7 +476,8 @@ grpc_call_error grpc_server_request_registered_call( /* Create a server. Additional configuration for each incoming channel can be specified with args. If no additional configuration is needed, args can - be NULL. See grpc_channel_args for more. */ + be NULL. See grpc_channel_args for more. The data in 'args' need only live + through the invocation of this function. */ grpc_server *grpc_server_create(const grpc_channel_args *args); /* Register a completion queue with the server. Must be done for any completion @@ -511,9 +517,9 @@ void grpc_server_destroy(grpc_server *server); Tracers (usually controlled by the environment variable GRPC_TRACE) allow printf-style debugging on GRPC internals, and are useful for - tracking down problems in the field. + tracking down problems in the field. - Use of this function is not strictly thread-safe, but the + Use of this function is not strictly thread-safe, but the thread-safety issues raised by it should not be of concern. */ int grpc_tracer_set_enabled(const char *name, int enabled); diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index e104b6952f..7a6aa66670 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -195,8 +195,7 @@ grpc_call_error grpc_call_set_credentials(grpc_call *call, /* TODO(jboeuf): Define some well-known property names. */ -#define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME \ - "transport_security_type" +#define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME "transport_security_type" #define GRPC_FAKE_TRANSPORT_SECURITY_TYPE "fake" #define GRPC_SSL_TRANSPORT_SECURITY_TYPE "ssl" @@ -251,4 +250,4 @@ const grpc_auth_context *grpc_call_auth_context(grpc_call *call); } #endif -#endif /* GRPC_GRPC_SECURITY_H */ +#endif /* GRPC_GRPC_SECURITY_H */ diff --git a/include/grpc/support/slice.h b/include/grpc/support/slice.h index 3ee103bfb9..b558bc515d 100644 --- a/include/grpc/support/slice.h +++ b/include/grpc/support/slice.h @@ -176,4 +176,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b); } #endif -#endif /* GRPC_SUPPORT_SLICE_H */ +#endif /* GRPC_SUPPORT_SLICE_H */ diff --git a/include/grpc/support/tls_pthread.h b/include/grpc/support/tls_pthread.h index c18f247af9..50e55d367d 100644 --- a/include/grpc/support/tls_pthread.h +++ b/include/grpc/support/tls_pthread.h @@ -34,7 +34,7 @@ #ifndef GRPC_SUPPORT_TLS_PTHREAD_H #define GRPC_SUPPORT_TLS_PTHREAD_H -#include <grpc/support/log.h> /* for GPR_ASSERT */ +#include <grpc/support/log.h> /* for GPR_ASSERT */ #include <pthread.h> /* Thread local storage based on pthread library calls. @@ -44,8 +44,7 @@ struct gpr_pthread_thread_local { pthread_key_t key; }; -#define GPR_TLS_DECL(name) \ - static struct gpr_pthread_thread_local name = {0} +#define GPR_TLS_DECL(name) static struct gpr_pthread_thread_local name = {0} #define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL)) #define gpr_tls_destroy(tls) pthread_key_delete((tls)->key) |