1 | /**
|
2 | * Copyright 2019, OpenCensus Authors
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 | /// <reference types="node" />
|
17 | /**
|
18 | * This module contains the functions for serializing and deserializing
|
19 | * TagMap (TagContext) with the binary format. It allows tags to propagate
|
20 | * across requests.
|
21 | *
|
22 | * <p>OpenCensus tag context encoding:
|
23 | *
|
24 | * <ul>
|
25 | * <li>Tags are encoded in single byte sequence. The version 0 format is:
|
26 | * <li>{@code <version_id><encoded_tags>}
|
27 | * <li>{@code <version_id> -> a single byte, value 0}
|
28 | * <li>{@code <encoded_tags> -> (<tag_field_id><tag_encoding>)*}
|
29 | * <ul>
|
30 | * <li>{@code <tag_field_id>} -> a single byte, value 0
|
31 | * <li>{@code <tag_encoding>}:
|
32 | * <ul>
|
33 | * <li>{@code <tag_key_len><tag_key><tag_val_len><tag_val>}
|
34 | * <ul>
|
35 | * <li>{@code <tag_key_len>} -> varint encoded integer
|
36 | * <li>{@code <tag_key>} -> tag_key_len bytes comprising tag name
|
37 | * <li>{@code <tag_val_len>} -> varint encoded integer
|
38 | * <li>{@code <tag_val>} -> tag_val_len bytes comprising tag value
|
39 | * </ul>
|
40 | * </li>
|
41 | * </ul>
|
42 | * </li>
|
43 | * </ul>
|
44 | * </ul>
|
45 | */
|
46 | import { TagMap } from '../tag-map';
|
47 | export declare const TAG_MAP_SERIALIZED_SIZE_LIMIT = 8192;
|
48 | /**
|
49 | * Serializes a given TagMap to the on-the-wire format.
|
50 | * @param tagMap The TagMap to serialize.
|
51 | */
|
52 | export declare function serializeBinary(tagMap: TagMap): Buffer;
|
53 | /**
|
54 | * Deserializes input to TagMap based on the binary format standard.
|
55 | * @param buffer The TagMap to deserialize.
|
56 | */
|
57 | export declare function deserializeBinary(buffer: Buffer): TagMap;
|