quiche: implement SimpleLinkedHashMap platform APIs#6782
quiche: implement SimpleLinkedHashMap platform APIs#6782alyssawilk merged 35 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
/assign @wu-bin |
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
| // TODO: implement | ||
| template <typename T> class QuicIntervalSetImpl; | ||
| template <typename Key, typename Value, int Size> | ||
| using QuicSmallMapImpl = std::unordered_map<Key, Value>; |
There was a problem hiding this comment.
How about absl::flat_hash_map, which is typically faster?
| deps = ["@envoy//source/extensions/quic_listeners/quiche/platform:spdy_platform_unsafe_arena_impl_lib"], | ||
| ) | ||
|
|
||
| envoy_cc_library( |
There was a problem hiding this comment.
As we discussed offline, can you split this library into smaller ones, mirroring the internal libraries?
There was a problem hiding this comment.
LG modulo a super small nit: Can we remove the "spdy" in the middle of the library name? i.e. change to "spdy_core_alt_svc_wire_format_lib". Same for "spdy_core_spdy_header_block_lib", "spdy_core_spdy_headers_handler_interface", "spdy_core_spdy_protocol_lib" and "spdy_core_spdy_test_utils_lib".
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "quiche_common_platform", |
There was a problem hiding this comment.
nit: I'd prefer "quiche_platform", for similarity with (quic|spdy|http2)_platform.
Your call. (If you do change it to quiche_platform, please also change quiche_common_platform_test to quiche_platform_test, and quiche_common_platform_impl_lib to quiche_platform_impl_lib)
There was a problem hiding this comment.
My concern is that if there are other directory added under quiche in the future, it will be hard to name those without specifying "common" here.
bazel/external/quiche.BUILD
Outdated
| ) | ||
|
|
||
| envoy_cc_test( | ||
| name = "quiche_spdy_core_test", |
There was a problem hiding this comment.
nit: For spdy test, please name it spdy_${something}_test.
|
|
||
| // Similar to std::unordered_map, but with better performance and memory usage. | ||
| template <typename Key, typename Value, typename Hash> | ||
| using QuicheUnorderedMapImpl = absl::node_hash_map<Key, Value, Hash>; |
There was a problem hiding this comment.
Is there a particular reason to use absl::node_hash_map instead of absl::flat_hash_map?
There was a problem hiding this comment.
flat_hash_map doesn't support key stability. Since this impl will probably replace QuicUnorderedMap which is used in several places as replacement of std::unordered_map. It will take some extra effort to investigate if those places requires key stability or not to switch to absl::flat_hash_map. And as we use node_hash_map in upstream, it's better to use the same class here to make sure future upstream change can be smoothly imported.
There was a problem hiding this comment.
SGTM. In the long term we should probably rename it to QuicheNodeHashMap and add a QuicheFlatHashMap, or directly use the absl ones if that's allowed.
| @@ -14,12 +20,7 @@ | |||
| // TODO(mpw): fix includes to use full paths. | |||
| #include "spdy_string_impl.h" | |||
There was a problem hiding this comment.
This TODO seems easy to fix, can you do it while we are here?
| @@ -0,0 +1,10 @@ | |||
| #pragma once | |||
There was a problem hiding this comment.
This file is already in test/extensions/..., which is correct since it's test only.
Can you remove this file?
There was a problem hiding this comment.
Ah, yes, this is not supposed to be here.
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
wu-bin
left a comment
There was a problem hiding this comment.
Looks great, just some nits on naming:)
bazel/external/quiche.BUILD
Outdated
| copts = quiche_copt, | ||
| repository = "@envoy", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ |
There was a problem hiding this comment.
nit: fold deps into a single line.
bazel/external/quiche.BUILD
Outdated
|
|
||
| envoy_cc_library( | ||
| name = "spdy_core_spdy_header_block_lib", | ||
| srcs = [ |
There was a problem hiding this comment.
nit: fold "srcs" and "hdrs" into a single line.
bazel/external/quiche.BUILD
Outdated
|
|
||
| envoy_cc_test_library( | ||
| name = "spdy_core_spdy_test_utils_lib", | ||
| srcs = [ |
There was a problem hiding this comment.
nit: fold "srcs" and "hdrs" into single lines.
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "quiche_common_platform", |
bazel/external/quiche.BUILD
Outdated
| ) | ||
|
|
||
| envoy_cc_test( | ||
| name = "spdy_header_block_test", |
There was a problem hiding this comment.
nit: Rename to spdy_core_header_block_test?
| deps = ["@envoy//source/extensions/quic_listeners/quiche/platform:spdy_platform_unsafe_arena_impl_lib"], | ||
| ) | ||
|
|
||
| envoy_cc_library( |
There was a problem hiding this comment.
LG modulo a super small nit: Can we remove the "spdy" in the middle of the library name? i.e. change to "spdy_core_alt_svc_wire_format_lib". Same for "spdy_core_spdy_header_block_lib", "spdy_core_spdy_headers_handler_interface", "spdy_core_spdy_protocol_lib" and "spdy_core_spdy_test_utils_lib".
|
|
||
| // Similar to std::unordered_map, but with better performance and memory usage. | ||
| template <typename Key, typename Value, typename Hash> | ||
| using QuicheUnorderedMapImpl = absl::node_hash_map<Key, Value, Hash>; |
There was a problem hiding this comment.
SGTM. In the long term we should probably rename it to QuicheNodeHashMap and add a QuicheFlatHashMap, or directly use the absl ones if that's allowed.
| // consumed or referenced directly by other Envoy code. It serves purely as a | ||
| // porting layer for QUICHE. | ||
|
|
||
| #include "absl/hash/hash.h" |
There was a problem hiding this comment.
I think the two includes will be reordered if you run "fix_format".
Signed-off-by: Dan Zhang <danzh@google.com>
wu-bin
left a comment
There was a problem hiding this comment.
Looks great to me. I took a look at the clang-tidy failure again, but still can't figure out why. @htuch @mpwarres : Any idea?
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
@lizan any idea about the clang_tidy failure? Apparently not missing files in deps, otherwise other ci would have failed. |
| "abseil_node_hash_map", | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| deps = [":quic_platform_base_impl_lib"], |
There was a problem hiding this comment.
add :quic_platform_logging_impl_lib to fix clang-tidy, bazel doesn't build header files only target explicitly but clang-tidy checks whether you added dependencies correctly.
There was a problem hiding this comment.
Woops, just realized another problem that quic_logging_impl.h is duplicated in both quic_platform_logging_impl_lib and quic_platform_base_impl_lib.
Fixed. Thanks for looking into this problem!
There was a problem hiding this comment.
Still not fixed. This is really weird. Looking at the errors a few lines above:
Error while processing /source/source/extensions/quic_listeners/quiche/platform/quic_containers_impl.h.
10294 warnings and 1 error generated.
Error while processing /source/test/extensions/quic_listeners/quiche/platform/quiche_test_impl.h.
16998 warnings and 1 error generated.
Error while processing /source/source/extensions/quic_listeners/quiche/platform/quiche_logging_impl.h.
23702 warnings and 1 error generated.
Error while processing /source/source/extensions/quic_listeners/quiche/platform/quiche_logging_impl.cc.
31722 warnings and 1 error generated.
Error while processing /source/source/extensions/quic_listeners/quiche/platform/spdy_containers_impl.h.
37223 warnings and 1 error generated.
Error while processing /source/source/extensions/quic_listeners/quiche/platform/spdy_string_utils_impl.h.
39075 warnings and 1 error generated.
Error while processing /source/source/extensions/quic_listeners/quiche/platform/quiche_ptr_util_impl.h.
43844 warnings and 1 error generated.
Error while processing /source/source/extensions/quic_listeners/quiche/platform/quiche_unordered_containers_impl.h.
warning: do not reference any 'internal' namespaces; those implementation details are reserved to Abseil [abseil-no-internal-dependencies]
bazel-out/k8-fastbuild/genfiles/external/com_googlesource_quiche/quiche/common/platform/api/quiche_logging.h:4:10: error: 'extensions/quic_listeners/quiche/platform/quiche_logging_impl.h' file not found [clang-diagnostic-error]
#include "extensions/quic_listeners/quiche/platform/quiche_logging_impl.h"
The file path is /source/source/extensions/quic_listeners/quiche/platform/... or /source/test/extensions/quic_listeners/quiche/platform/.... There is a /source added to the actual file path.
Why would clang_tidy CI do that?
There was a problem hiding this comment.
CI image checkout repository to /source so the path is correct.
|
/assign @mattklein123 |
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
|
previous clang_tidy failure was caused by a circular dependency. Fixed now. PTAL |
| // #include "extensions/quic_listeners/quiche/platform/spdy_string_impl.h" | ||
| // #include "extensions/quic_listeners/quiche/platform/spdy_string_piece_impl.h" | ||
| // | ||
| // However, for some reason, bazel.clang_tidy cannot resolve the files when specified this way. |
There was a problem hiding this comment.
Should this part of the comment be removed as well?
There was a problem hiding this comment.
Oh, yes, they should. Done.
Signed-off-by: Dan Zhang <danzh@google.com>
Add platform implementations for quiche::SimpleLinkedHashMap. And enable simple_linked_hash_map_test.cc.
Finish TODOs in quic|spdy_containsers_impl.h to implement Quic|SpdyLinkedHashMap with SimpleLinkedHashMap.
Add a few spdy build targets and test target: spdy_core_header_block_test which tests SpdyHeaderBlock which uses SimpleLinkedHashMap.
Update tar ball to 7bf7c3c358eb954e463bde14ea27444f4bd8ea05.
Risk Level: low, not used
Testing: enabled quiche tests: simple_linked_hash_map_test.cc and spdy_header_block_test.cc
Part of #2557