From bb30d2591fc52c5bacc309c107077d92d5afc70a Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Tue, 12 Jan 2016 17:36:05 -0800 Subject: initial commit --- tools/doxygen/Doxyfile.core.internal | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/doxygen/Doxyfile.core.internal') diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index aef5bec86b..ac57dd03b7 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -897,6 +897,7 @@ src/core/transport/transport_impl.h \ src/core/census/aggregation.h \ src/core/census/context.h \ src/core/census/rpc_metric_id.h \ +src/core/census/tag_set.h \ src/core/httpcli/httpcli_security_connector.c \ src/core/security/base64.c \ src/core/security/client_auth_filter.c \ @@ -1046,6 +1047,7 @@ src/core/transport/transport_op_string.c \ src/core/census/context.c \ src/core/census/initialize.c \ src/core/census/operation.c \ +src/core/census/tag_set.c \ src/core/census/tracing.c \ include/grpc/support/alloc.h \ include/grpc/support/atm.h \ -- cgit v1.2.3 From 0f690721bdc977b5d506e575f5e13be6d09c57fd Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Wed, 13 Jan 2016 09:08:38 -0800 Subject: Move encode/decode API into census.h --- BUILD | 3 -- Makefile | 1 + build.yaml | 1 - gRPC.podspec | 4 +- include/grpc/census.h | 20 +++++++- src/core/census/tag_set.c | 6 +-- src/core/census/tag_set.h | 57 ---------------------- src/python/grpcio/grpc_core_dependencies.py | 1 + test/core/census/tag_set_test.c | 2 +- tools/doxygen/Doxyfile.core.internal | 1 - tools/run_tests/sources_and_headers.json | 4 -- vsprojects/vcxproj/grpc/grpc.vcxproj | 1 - vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 3 -- .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 1 - .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 3 -- 15 files changed, 23 insertions(+), 85 deletions(-) delete mode 100644 src/core/census/tag_set.h (limited to 'tools/doxygen/Doxyfile.core.internal') diff --git a/BUILD b/BUILD index ae1a69073f..43e7ba3e18 100644 --- a/BUILD +++ b/BUILD @@ -268,7 +268,6 @@ cc_library( "src/core/census/aggregation.h", "src/core/census/context.h", "src/core/census/rpc_metric_id.h", - "src/core/census/tag_set.h", "src/core/httpcli/httpcli_security_connector.c", "src/core/security/base64.c", "src/core/security/client_auth_filter.c", @@ -561,7 +560,6 @@ cc_library( "src/core/census/aggregation.h", "src/core/census/context.h", "src/core/census/rpc_metric_id.h", - "src/core/census/tag_set.h", "src/core/surface/init_unsecure.c", "src/core/census/grpc_context.c", "src/core/census/grpc_filter.c", @@ -1367,7 +1365,6 @@ objc_library( "src/core/census/aggregation.h", "src/core/census/context.h", "src/core/census/rpc_metric_id.h", - "src/core/census/tag_set.h", ], includes = [ "include", diff --git a/Makefile b/Makefile index c359ca0375..a1b08b414b 100644 --- a/Makefile +++ b/Makefile @@ -8303,6 +8303,7 @@ $(BINDIR)/$(CONFIG)/tag_set_test: $(TAG_SET_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgr endif $(OBJDIR)/$(CONFIG)/test/core/census/tag_set_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + deps_tag_set_test: $(TAG_SET_TEST_OBJS:.o=.dep) ifneq ($(NO_SECURE),true) diff --git a/build.yaml b/build.yaml index 1177564f17..02bab57859 100644 --- a/build.yaml +++ b/build.yaml @@ -16,7 +16,6 @@ filegroups: - src/core/census/aggregation.h - src/core/census/context.h - src/core/census/rpc_metric_id.h - - src/core/census/tag_set.h src: - src/core/census/context.c - src/core/census/initialize.c diff --git a/gRPC.podspec b/gRPC.podspec index 4acf2d7e1b..cde97ac661 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -272,7 +272,6 @@ Pod::Spec.new do |s| 'src/core/census/aggregation.h', 'src/core/census/context.h', 'src/core/census/rpc_metric_id.h', - 'src/core/census/tag_set.h', 'include/grpc/grpc_security.h', 'include/grpc/byte_buffer.h', 'include/grpc/byte_buffer_reader.h', @@ -571,8 +570,7 @@ Pod::Spec.new do |s| 'src/core/transport/transport_impl.h', 'src/core/census/aggregation.h', 'src/core/census/context.h', - 'src/core/census/rpc_metric_id.h', - 'src/core/census/tag_set.h' + 'src/core/census/rpc_metric_id.h' ss.header_mappings_dir = '.' # This isn't officially supported in Cocoapods. We've asked for an alternative: diff --git a/include/grpc/census.h b/include/grpc/census.h index 908bcc96e2..2a62f4daca 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -339,7 +339,7 @@ typedef struct { const char *key; const char *value; size_t value_len; - gpr_uint8 flags; + uint8_t flags; } census_tag; /* Tag flags. */ @@ -386,6 +386,22 @@ int census_tag_set_get_tag_by_index(const census_tag_set *tags, int index, int census_tag_set_get_tag_by_key(const census_tag_set *tags, const char *key, census_tag *tag); +/* Encode to-be-propagated non-binary tags from a tag set into a memory + buffer. The total number of bytes used in the buffer is returned. If the + buffer is too small to contain the encoded tag set, then 0 is returned. */ +size_t census_tag_set_encode_propagated(const census_tag_set *tags, + char *buffer, size_t buf_size); + +/* Encode to-be-propagated binary tags from a tag set into a memory + buffer. The total number of bytes used in the buffer is returned. If the + buffer is too small to contain the encoded tag set, then 0 is returned. */ +size_t census_tag_set_encode_propagated_binary(const census_tag_set *tags, + char *buffer, size_t buf_size); + +/* Decode tag set buffers encoded with census_tag_set_encode_*(). */ +census_tag_set *census_tag_set_decode(const char *buffer, size_t size, + const char *bin_buffer, size_t bin_size); + /* Get a contexts tag set. */ census_tag_set *census_context_tag_set(census_context *context); diff --git a/src/core/census/tag_set.c b/src/core/census/tag_set.c index 80c209031f..fcfe67afad 100644 --- a/src/core/census/tag_set.c +++ b/src/core/census/tag_set.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,17 +31,13 @@ * */ -#include "tag_set.h" - #include #include #include #include -#include #include #include #include -#include "src/core/support/murmur_hash.h" #include "src/core/support/string.h" // Functions in this file support the public tag_set API, as well as diff --git a/src/core/census/tag_set.h b/src/core/census/tag_set.h deleted file mode 100644 index 9eec0ad438..0000000000 --- a/src/core/census/tag_set.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPC_INTERNAL_CORE_CENSUS_TAG_SET_H -#define GRPC_INTERNAL_CORE_CENSUS_TAG_SET_H - -#include -#include -#include - -/* Encode to-be-propagated tags from a tag set into a memory buffer. The total - number of bytes used in the buffer is returned. If the buffer is too small - to contain the encoded tag set, then 0 is returned. */ -size_t census_tag_set_encode_propagated(const census_tag_set *tags, - char *buffer, size_t buf_size); - -/* Encode to-be-propagated binary tags from a tag set into a memory - buffer. The total number of bytes used in the buffer is returned. If the - buffer is too small to contain the encoded tag set, then 0 is returned. */ -size_t census_tag_set_encode_propagated_binary(const census_tag_set *tags, - char *buffer, size_t buf_size); - -/* Decode tag set buffers encoded with census_tag_set_encode_*(). */ -census_tag_set *census_tag_set_decode(const char *buffer, size_t size, - const char *bin_buffer, size_t bin_size); - -#endif /* GRPC_INTERNAL_CORE_CENSUS_TAG_SET_H */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 63cf0a4c74..f5b8b897f9 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -220,6 +220,7 @@ CORE_SOURCE_FILES = [ 'src/core/census/context.c', 'src/core/census/initialize.c', 'src/core/census/operation.c', + 'src/core/census/tag_set.c', 'src/core/census/tracing.c', 'src/boringssl/err_data.c', 'third_party/boringssl/crypto/aes/aes.c', diff --git a/test/core/census/tag_set_test.c b/test/core/census/tag_set_test.c index d6a7e45334..44ecb2819c 100644 --- a/test/core/census/tag_set_test.c +++ b/test/core/census/tag_set_test.c @@ -33,7 +33,7 @@ // Test census_tag_set functions, including encoding/decoding -#include "src/core/census/tag_set.h" +#include #include #include #include diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index ac57dd03b7..222ad3c6a2 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -897,7 +897,6 @@ src/core/transport/transport_impl.h \ src/core/census/aggregation.h \ src/core/census/context.h \ src/core/census/rpc_metric_id.h \ -src/core/census/tag_set.h \ src/core/httpcli/httpcli_security_connector.c \ src/core/security/base64.c \ src/core/security/client_auth_filter.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 5e474a8b7b..4067863f89 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -2874,7 +2874,6 @@ "src/core/census/context.h", "src/core/census/grpc_filter.h", "src/core/census/rpc_metric_id.h", - "src/core/census/tag_set.h", "src/core/channel/channel_args.h", "src/core/channel/channel_stack.h", "src/core/channel/client_channel.h", @@ -3022,7 +3021,6 @@ "src/core/census/operation.c", "src/core/census/rpc_metric_id.h", "src/core/census/tag_set.c", - "src/core/census/tag_set.h", "src/core/census/tracing.c", "src/core/channel/channel_args.c", "src/core/channel/channel_args.h", @@ -3389,7 +3387,6 @@ "src/core/census/context.h", "src/core/census/grpc_filter.h", "src/core/census/rpc_metric_id.h", - "src/core/census/tag_set.h", "src/core/channel/channel_args.h", "src/core/channel/channel_stack.h", "src/core/channel/client_channel.h", @@ -3522,7 +3519,6 @@ "src/core/census/operation.c", "src/core/census/rpc_metric_id.h", "src/core/census/tag_set.c", - "src/core/census/tag_set.h", "src/core/census/tracing.c", "src/core/channel/channel_args.c", "src/core/channel/channel_args.h", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 037b8ff222..b143de9d86 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -404,7 +404,6 @@ - diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 0ddbd5e46d..93848293c6 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -869,9 +869,6 @@ src\core\census - - src\core\census - diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index a3532e5d05..dae8edf17f 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -382,7 +382,6 @@ - diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index f63e3012e7..1f850b2629 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -764,9 +764,6 @@ src\core\census - - src\core\census - -- cgit v1.2.3