Skip to content

Commit 8537e5c

Browse files
authored
router: convert InlinedVector to an array (#40132)
Minor internal refactor - using an array instead of a dynamic vector. Fits better with the data-structure intent and uses a bit less memory. Signed-off-by: Adi Suissa-Peleg <[email protected]>
1 parent 1ff11ab commit 8537e5c

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

source/common/router/config_impl.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ namespace {
127127

128128
constexpr uint32_t DEFAULT_MAX_DIRECT_RESPONSE_BODY_SIZE_BYTES = 4096;
129129

130-
// Returns a vector of header parsers, sorted by specificity. The `specificity_ascend` parameter
130+
// Returns an array of header parsers, sorted by specificity. The `specificity_ascend` parameter
131131
// specifies whether the returned parsers will be sorted from least specific to most specific
132132
// (global connection manager level header parser, virtual host level header parser and finally
133133
// route-level parser.) or the reverse.
134-
absl::InlinedVector<const HeaderParser*, 3>
134+
std::array<const HeaderParser*, 3>
135135
getHeaderParsers(const HeaderParser* global_route_config_header_parser,
136136
const HeaderParser* vhost_header_parser, const HeaderParser* route_header_parser,
137137
bool specificity_ascend) {
@@ -977,14 +977,14 @@ RouteEntryImplBase::requestHeaderTransforms(const StreamInfo::StreamInfo& stream
977977
return transforms;
978978
}
979979

980-
absl::InlinedVector<const HeaderParser*, 3>
980+
std::array<const HeaderParser*, 3>
981981
RouteEntryImplBase::getRequestHeaderParsers(bool specificity_ascend) const {
982982
return getHeaderParsers(&vhost_->globalRouteConfig().requestHeaderParser(),
983983
&vhost_->requestHeaderParser(), &requestHeaderParser(),
984984
specificity_ascend);
985985
}
986986

987-
absl::InlinedVector<const HeaderParser*, 3>
987+
std::array<const HeaderParser*, 3>
988988
RouteEntryImplBase::getResponseHeaderParsers(bool specificity_ascend) const {
989989
return getHeaderParsers(&vhost_->globalRouteConfig().responseHeaderParser(),
990990
&vhost_->responseHeaderParser(), &responseHeaderParser(),

source/common/router/config_impl.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -846,26 +846,24 @@ class RouteEntryImplBase : public RouteEntryAndRoute,
846846
};
847847

848848
/**
849-
* Returns a vector of request header parsers which applied or will apply header transformations
849+
* Returns an array of request header parsers which applied or will apply header transformations
850850
* to the request in this route.
851851
* @param specificity_ascend specifies whether the returned parsers will be sorted from least
852852
* specific to most specific (global connection manager level header parser, virtual host
853853
* level header parser and finally route-level parser.) or the reverse.
854-
* @return a vector of request header parsers.
854+
* @return an array of request header parsers.
855855
*/
856-
absl::InlinedVector<const HeaderParser*, 3>
857-
getRequestHeaderParsers(bool specificity_ascend) const;
856+
std::array<const HeaderParser*, 3> getRequestHeaderParsers(bool specificity_ascend) const;
858857

859858
/**
860-
* Returns a vector of response header parsers which applied or will apply header transformations
859+
* Returns an array of response header parsers which applied or will apply header transformations
861860
* to the response in this route.
862861
* @param specificity_ascend specifies whether the returned parsers will be sorted from least
863862
* specific to most specific (global connection manager level header parser, virtual host
864863
* level header parser and finally route-level parser.) or the reverse.
865-
* @return a vector of request header parsers.
864+
* @return an array of request header parsers.
866865
*/
867-
absl::InlinedVector<const HeaderParser*, 3>
868-
getResponseHeaderParsers(bool specificity_ascend) const;
866+
std::array<const HeaderParser*, 3> getResponseHeaderParsers(bool specificity_ascend) const;
869867

870868
std::unique_ptr<const RuntimeData>
871869
loadRuntimeData(const envoy::config::route::v3::RouteMatch& route);

0 commit comments

Comments
 (0)