Move encode/decode API into census.h

pull/4750/head
Alistair Veitch 9 years ago
parent f190601e60
commit 0f690721bd
  1. 3
      BUILD
  2. 1
      Makefile
  3. 1
      build.yaml
  4. 4
      gRPC.podspec
  5. 20
      include/grpc/census.h
  6. 6
      src/core/census/tag_set.c
  7. 57
      src/core/census/tag_set.h
  8. 1
      src/python/grpcio/grpc_core_dependencies.py
  9. 2
      test/core/census/tag_set_test.c
  10. 1
      tools/doxygen/Doxyfile.core.internal
  11. 4
      tools/run_tests/sources_and_headers.json
  12. 1
      vsprojects/vcxproj/grpc/grpc.vcxproj
  13. 3
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  14. 1
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  15. 3
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters

@ -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",

@ -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)

@ -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

@ -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:

@ -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);

@ -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 <grpc/census.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
#include <stdbool.h>
#include <string.h>
#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

@ -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 <grpc/census.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
/* 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 */

@ -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',

@ -33,7 +33,7 @@
// Test census_tag_set functions, including encoding/decoding
#include "src/core/census/tag_set.h"
#include <grpc/census.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <stdbool.h>

@ -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 \

@ -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",

@ -404,7 +404,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\census\aggregation.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\census\context.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\census\rpc_metric_id.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\census\tag_set.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(SolutionDir)\..\src\core\httpcli\httpcli_security_connector.c">

@ -869,9 +869,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\census\rpc_metric_id.h">
<Filter>src\core\census</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\census\tag_set.h">
<Filter>src\core\census</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>

@ -382,7 +382,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\census\aggregation.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\census\context.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\census\rpc_metric_id.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\census\tag_set.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(SolutionDir)\..\src\core\surface\init_unsecure.c">

@ -764,9 +764,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\census\rpc_metric_id.h">
<Filter>src\core\census</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\census\tag_set.h">
<Filter>src\core\census</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>

Loading…
Cancel
Save