/proc/self/cwd/source/extensions/filters/network/dubbo_proxy/router/router.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | #include <memory> |
4 | | #include <string> |
5 | | |
6 | | #include "envoy/rds/config.h" |
7 | | #include "envoy/router/router.h" |
8 | | |
9 | | #include "source/extensions/filters/network/dubbo_proxy/metadata.h" |
10 | | |
11 | | namespace Envoy { |
12 | | namespace Extensions { |
13 | | namespace NetworkFilters { |
14 | | namespace DubboProxy { |
15 | | namespace Router { |
16 | | |
17 | | /** |
18 | | * RouteEntry is an individual resolved route entry. |
19 | | */ |
20 | | class RouteEntry { |
21 | | public: |
22 | 0 | virtual ~RouteEntry() = default; |
23 | | |
24 | | /** |
25 | | * @return const std::string& the upstream cluster that owns the route. |
26 | | */ |
27 | | virtual const std::string& clusterName() const PURE; |
28 | | |
29 | | /** |
30 | | * @return MetadataMatchCriteria* the metadata that a subset load balancer should match when |
31 | | * selecting an upstream host |
32 | | */ |
33 | | virtual const Envoy::Router::MetadataMatchCriteria* metadataMatchCriteria() const PURE; |
34 | | }; |
35 | | |
36 | | using RouteEntryPtr = std::shared_ptr<RouteEntry>; |
37 | | |
38 | | /** |
39 | | * Route holds the RouteEntry for a request. |
40 | | */ |
41 | | class Route { |
42 | | public: |
43 | 0 | virtual ~Route() = default; |
44 | | |
45 | | /** |
46 | | * @return the route entry or nullptr if there is no matching route for the request. |
47 | | */ |
48 | | virtual const RouteEntry* routeEntry() const PURE; |
49 | | }; |
50 | | |
51 | | using RouteConstSharedPtr = std::shared_ptr<const Route>; |
52 | | using RouteSharedPtr = std::shared_ptr<Route>; |
53 | | |
54 | | /** |
55 | | * The router configuration. |
56 | | */ |
57 | | class Config : public Rds::Config { |
58 | | public: |
59 | | /** |
60 | | * Based on the incoming Dubbo request transport and/or protocol data, determine the target |
61 | | * route for the request. |
62 | | * @param metadata MessageMetadata for the message to route |
63 | | * @param random_value uint64_t used to select cluster affinity |
64 | | * @return the route or nullptr if there is no matching route for the request. |
65 | | */ |
66 | | virtual RouteConstSharedPtr route(const MessageMetadata& metadata, |
67 | | uint64_t random_value) const PURE; |
68 | | }; |
69 | | |
70 | | using ConfigConstSharedPtr = std::shared_ptr<const Config>; |
71 | | |
72 | | } // namespace Router |
73 | | } // namespace DubboProxy |
74 | | } // namespace NetworkFilters |
75 | | } // namespace Extensions |
76 | | } // namespace Envoy |