diff options
author | Craig Tiller <ctiller@google.com> | 2016-11-16 14:56:34 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-11-16 14:56:34 -0800 |
commit | 1016d9feca27f295fb8fe1c0e76a9fbd0ef14051 (patch) | |
tree | 5f9ce273109af25c2e8585118bd2b77fd2bd1227 /include/grpc++ | |
parent | 13fda37dee1b1de6dda079b3a019e138352ee176 (diff) | |
parent | 740665a6f65b3d827e0755de8bb1bcd57745b9f1 (diff) |
Merge github.com:grpc/grpc into bm_fullstack
Diffstat (limited to 'include/grpc++')
-rw-r--r-- | include/grpc++/impl/codegen/completion_queue.h | 2 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/core_codegen.h | 14 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/core_codegen_interface.h | 15 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/proto_utils.h | 46 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/thrift_serializer.h | 12 | ||||
-rw-r--r-- | include/grpc++/support/channel_arguments.h | 3 | ||||
-rw-r--r-- | include/grpc++/support/slice.h | 20 |
7 files changed, 58 insertions, 54 deletions
diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 29bc97fdf7..ef00163b7e 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -240,7 +240,7 @@ class ServerCompletionQueue : public CompletionQueue { private: bool is_frequently_polled_; friend class ServerBuilder; - /// \param is_frequently_polled Informs the GPRC library about whether the + /// \param is_frequently_polled Informs the GRPC library about whether the /// server completion queue would be actively polled (by calling Next() or /// AsyncNext()). By default all server completion queues are assumed to be /// frequently polled. diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index aff88ffa07..6b5e637e4e 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -71,16 +71,16 @@ class CoreCodegen : public CoreCodegenInterface { void grpc_byte_buffer_reader_destroy( grpc_byte_buffer_reader* reader) override; int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, - gpr_slice* slice) override; + grpc_slice* slice) override; - grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice, + grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, size_t nslices) override; - gpr_slice gpr_slice_malloc(size_t length) override; - void gpr_slice_unref(gpr_slice slice) override; - gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) override; - void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) override; - void gpr_slice_buffer_pop(gpr_slice_buffer* sb) override; + grpc_slice grpc_slice_malloc(size_t length) override; + void grpc_slice_unref(grpc_slice slice) override; + grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) override; + void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice slice) override; + void grpc_slice_buffer_pop(grpc_slice_buffer* sb) override; void grpc_metadata_array_init(grpc_metadata_array* array) override; void grpc_metadata_array_destroy(grpc_metadata_array* array) override; diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 68851f15c6..4783a43454 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -88,16 +88,17 @@ class CoreCodegenInterface { virtual void grpc_byte_buffer_reader_destroy( grpc_byte_buffer_reader* reader) = 0; virtual int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, - gpr_slice* slice) = 0; + grpc_slice* slice) = 0; - virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice, + virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, size_t nslices) = 0; - virtual gpr_slice gpr_slice_malloc(size_t length) = 0; - virtual void gpr_slice_unref(gpr_slice slice) = 0; - virtual gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) = 0; - virtual void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) = 0; - virtual void gpr_slice_buffer_pop(gpr_slice_buffer* sb) = 0; + virtual grpc_slice grpc_slice_malloc(size_t length) = 0; + virtual void grpc_slice_unref(grpc_slice slice) = 0; + virtual grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) = 0; + virtual void grpc_slice_buffer_add(grpc_slice_buffer* sb, + grpc_slice slice) = 0; + virtual void grpc_slice_buffer_pop(grpc_slice_buffer* sb) = 0; virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0; virtual void grpc_metadata_array_destroy(grpc_metadata_array* array) = 0; diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h index cbaa3e7bf2..2f15487591 100644 --- a/include/grpc++/impl/codegen/proto_utils.h +++ b/include/grpc++/impl/codegen/proto_utils.h @@ -63,7 +63,7 @@ class GrpcBufferWriter final ~GrpcBufferWriter() override { if (have_backup_) { - g_core_codegen_interface->gpr_slice_unref(backup_slice_); + g_core_codegen_interface->grpc_slice_unref(backup_slice_); } } @@ -72,24 +72,24 @@ class GrpcBufferWriter final slice_ = backup_slice_; have_backup_ = false; } else { - slice_ = g_core_codegen_interface->gpr_slice_malloc(block_size_); + slice_ = g_core_codegen_interface->grpc_slice_malloc(block_size_); } - *data = GPR_SLICE_START_PTR(slice_); + *data = GRPC_SLICE_START_PTR(slice_); // On win x64, int is only 32bit - GPR_CODEGEN_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX); - byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_); - g_core_codegen_interface->gpr_slice_buffer_add(slice_buffer_, slice_); + GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX); + byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_); + g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_); return true; } void BackUp(int count) override { - g_core_codegen_interface->gpr_slice_buffer_pop(slice_buffer_); + g_core_codegen_interface->grpc_slice_buffer_pop(slice_buffer_); if (count == block_size_) { backup_slice_ = slice_; } else { - backup_slice_ = g_core_codegen_interface->gpr_slice_split_tail( - &slice_, GPR_SLICE_LENGTH(slice_) - count); - g_core_codegen_interface->gpr_slice_buffer_add(slice_buffer_, slice_); + backup_slice_ = g_core_codegen_interface->grpc_slice_split_tail( + &slice_, GRPC_SLICE_LENGTH(slice_) - count); + g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_); } have_backup_ = true; byte_count_ -= count; @@ -100,10 +100,10 @@ class GrpcBufferWriter final private: const int block_size_; int64_t byte_count_; - gpr_slice_buffer* slice_buffer_; + grpc_slice_buffer* slice_buffer_; bool have_backup_; - gpr_slice backup_slice_; - gpr_slice slice_; + grpc_slice backup_slice_; + grpc_slice slice_; }; class GrpcBufferReader final @@ -126,7 +126,7 @@ class GrpcBufferReader final return false; } if (backup_count_ > 0) { - *data = GPR_SLICE_START_PTR(slice_) + GPR_SLICE_LENGTH(slice_) - + *data = GRPC_SLICE_START_PTR(slice_) + GRPC_SLICE_LENGTH(slice_) - backup_count_; GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX); *size = (int)backup_count_; @@ -137,11 +137,11 @@ class GrpcBufferReader final &slice_)) { return false; } - g_core_codegen_interface->gpr_slice_unref(slice_); - *data = GPR_SLICE_START_PTR(slice_); + g_core_codegen_interface->grpc_slice_unref(slice_); + *data = GRPC_SLICE_START_PTR(slice_); // On win x64, int is only 32bit - GPR_CODEGEN_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX); - byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_); + GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX); + byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_); return true; } @@ -172,7 +172,7 @@ class GrpcBufferReader final int64_t byte_count_; int64_t backup_count_; grpc_byte_buffer_reader reader_; - gpr_slice slice_; + grpc_slice slice_; Status status_; }; } // namespace internal @@ -186,12 +186,12 @@ class SerializationTraits<T, typename std::enable_if<std::is_base_of< *own_buffer = true; int byte_size = msg.ByteSize(); if (byte_size <= internal::kGrpcBufferWriterMaxBufferLength) { - gpr_slice slice = g_core_codegen_interface->gpr_slice_malloc(byte_size); + grpc_slice slice = g_core_codegen_interface->grpc_slice_malloc(byte_size); GPR_CODEGEN_ASSERT( - GPR_SLICE_END_PTR(slice) == - msg.SerializeWithCachedSizesToArray(GPR_SLICE_START_PTR(slice))); + GRPC_SLICE_END_PTR(slice) == + msg.SerializeWithCachedSizesToArray(GRPC_SLICE_START_PTR(slice))); *bp = g_core_codegen_interface->grpc_raw_byte_buffer_create(&slice, 1); - g_core_codegen_interface->gpr_slice_unref(slice); + g_core_codegen_interface->grpc_slice_unref(slice); return g_core_codegen_interface->ok(); } else { internal::GrpcBufferWriter writer( diff --git a/include/grpc++/impl/codegen/thrift_serializer.h b/include/grpc++/impl/codegen/thrift_serializer.h index fd324a994f..86bc7105c0 100644 --- a/include/grpc++/impl/codegen/thrift_serializer.h +++ b/include/grpc++/impl/codegen/thrift_serializer.h @@ -109,12 +109,12 @@ class ThriftSerializer { Serialize(fields, &byte_buffer, &byte_buffer_size); - gpr_slice slice = gpr_slice_from_copied_buffer( + grpc_slice slice = grpc_slice_from_copied_buffer( reinterpret_cast<const char*>(byte_buffer), byte_buffer_size); *bp = grpc_raw_byte_buffer_create(&slice, 1); - gpr_slice_unref(slice); + grpc_slice_unref(slice); } // Deserialize the passed char array into the passed type, returns the number @@ -156,12 +156,12 @@ class ThriftSerializer { grpc_byte_buffer_reader reader; grpc_byte_buffer_reader_init(&reader, buffer); - gpr_slice slice = grpc_byte_buffer_reader_readall(&reader); + grpc_slice slice = grpc_byte_buffer_reader_readall(&reader); uint32_t len = - Deserialize(GPR_SLICE_START_PTR(slice), GPR_SLICE_LENGTH(slice), msg); + Deserialize(GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice), msg); - gpr_slice_unref(slice); + grpc_slice_unref(slice); grpc_byte_buffer_reader_destroy(&reader); @@ -214,4 +214,4 @@ typedef ThriftSerializer<void, TCompactProtocolT<TBufferBase>> } // namespace thrift } // namespace apache -#endif +#endif // GRPCXX_IMPL_CODEGEN_THRIFT_SERIALIZER_H diff --git a/include/grpc++/support/channel_arguments.h b/include/grpc++/support/channel_arguments.h index bbfb056b79..5879f40447 100644 --- a/include/grpc++/support/channel_arguments.h +++ b/include/grpc++/support/channel_arguments.h @@ -79,6 +79,9 @@ class ChannelArguments { /// Set the compression algorithm for the channel. void SetCompressionAlgorithm(grpc_compression_algorithm algorithm); + /// Set the socket mutator for the channel. + void SetSocketMutator(grpc_socket_mutator* mutator); + /// The given string will be sent at the front of the user agent string. void SetUserAgentPrefix(const grpc::string& user_agent_prefix); diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h index 85561f7f33..3ec0d1af80 100644 --- a/include/grpc++/support/slice.h +++ b/include/grpc++/support/slice.h @@ -35,11 +35,11 @@ #define GRPCXX_SUPPORT_SLICE_H #include <grpc++/support/config.h> -#include <grpc/support/slice.h> +#include <grpc/slice.h> namespace grpc { -/// A wrapper around \a gpr_slice. +/// A wrapper around \a grpc_slice. /// /// A slice represents a contiguous reference counted array of bytes. /// It is cheap to take references to a slice, and it is cheap to create a @@ -53,11 +53,11 @@ class Slice final { enum AddRef { ADD_REF }; /// Construct a slice from \a slice, adding a reference. - Slice(gpr_slice slice, AddRef); + Slice(grpc_slice slice, AddRef); enum StealRef { STEAL_REF }; /// Construct a slice from \a slice, stealing a reference. - Slice(gpr_slice slice, StealRef); + Slice(grpc_slice slice, StealRef); /// Copy constructor, adds a reference. Slice(const Slice& other); @@ -69,21 +69,21 @@ class Slice final { } /// Byte size. - size_t size() const { return GPR_SLICE_LENGTH(slice_); } + size_t size() const { return GRPC_SLICE_LENGTH(slice_); } /// Raw pointer to the beginning (first element) of the slice. - const uint8_t* begin() const { return GPR_SLICE_START_PTR(slice_); } + const uint8_t* begin() const { return GRPC_SLICE_START_PTR(slice_); } /// Raw pointer to the end (one byte \em past the last element) of the slice. - const uint8_t* end() const { return GPR_SLICE_END_PTR(slice_); } + const uint8_t* end() const { return GRPC_SLICE_END_PTR(slice_); } - /// Raw C slice. Caller needs to call gpr_slice_unref when done. - gpr_slice c_slice() const { return gpr_slice_ref(slice_); } + /// Raw C slice. Caller needs to call grpc_slice_unref when done. + grpc_slice c_slice() const { return grpc_slice_ref(slice_); } private: friend class ByteBuffer; - gpr_slice slice_; + grpc_slice slice_; }; } // namespace grpc |