-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Description: Add MetadataEncoder and MetadataDecoder to codec. I also corrected some of the design decisions in MetadataEnocder and MetadataDecoder so that they are more suitable for codec. Those corrections includes: 1. let StreamImpl owns the decoded metadata, not the decoder. 2. Remove stream_id field in decoder and encoder since stream id is stored in StreamImpl. 3. Remove set/getMaxMetadataSize(), because nghttp2 uses default max frame size. This is the second step towards supporting metadata in envoy. The next step would be add filters to add/delete/modify metadata. Risk Level: Low. Not used. Testing: Unit test. Docs Changes: Release Notes: #2394 Signed-off-by: Yang Song <[email protected]>
- Loading branch information
1 parent
c41fa71
commit 7b96648
Showing
25 changed files
with
581 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <functional> | ||
#include <memory> | ||
#include <unordered_map> | ||
|
||
namespace Envoy { | ||
namespace Http { | ||
|
||
/** | ||
* Please refer to #2394 for more info about Envoy METADATA. | ||
* Envoy metadata docs can be found at source/docs/h2_metadata.md. | ||
*/ | ||
constexpr uint8_t METADATA_FRAME_TYPE = 0x4d; | ||
constexpr uint8_t END_METADATA_FLAG = 0x4; | ||
|
||
// NGHTTP2_MAX_PAYLOADLEN in nghttp2. | ||
// TODO(soya3129): Respect max_frame_size after nghttp2 #1250 is resolved. | ||
constexpr uint64_t METADATA_MAX_PAYLOAD_SIZE = 16384; | ||
|
||
using MetadataMap = std::unordered_map<std::string, std::string>; | ||
using MetadataMapPtr = std::unique_ptr<MetadataMap>; | ||
|
||
using MetadataCallback = std::function<void(std::unique_ptr<MetadataMap>)>; | ||
|
||
} // namespace Http | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.