-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
listener: first implementation of an Api Listener #9516
Changes from all commits
d182cbe
3c36ef8
d91b112
c6f2d8a
31b8ecd
cfa81d8
538d73c
ad81348
e617918
efe5cff
2760a21
1a57cf0
d74abb6
5684186
1427f3e
06d0043
3dd0b13
9f6094b
65e3a71
c9f429b
c8f9658
9647159
dad95f6
25d9494
45ec135
542ceda
ae1442c
1df8a3e
8354ad9
8624c14
6de2dbc
1c68d73
f4e8d9e
b2c9ba5
ce59043
7ce32a5
6f242d9
6e2ee13
df69e8c
0ce64d4
ed5e8e6
cacb666
c5f629a
ba3d861
2116afa
246eb28
50cb982
e1c789e
9b99e58
7d8ffe3
cd640b3
63c3afb
4d47fa5
516b71b
835adbb
77a5570
7442f86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include "envoy/http/codec.h" | ||
|
||
namespace Envoy { | ||
namespace Http { | ||
|
||
/** | ||
* ApiListener that allows consumers to interact with HTTP streams via API calls. | ||
*/ | ||
// TODO(junr03): this is a replica of the functions in ServerConnectionCallbacks. It would be nice | ||
// to not duplicate this interface layout. | ||
class ApiListener { | ||
public: | ||
virtual ~ApiListener() = default; | ||
|
||
/** | ||
* Invoked when a new request stream is initiated by the remote. | ||
* @param response_encoder supplies the encoder to use for creating the response. The request and | ||
* response are backed by the same Stream object. | ||
* @param is_internally_created indicates if this stream was originated by a | ||
* client, or was created by Envoy, by example as part of an internal redirect. | ||
* @return StreamDecoder& supplies the decoder callbacks to fire into for stream decoding events. | ||
*/ | ||
virtual StreamDecoder& newStream(StreamEncoder& response_encoder, | ||
bool is_internally_created = false) PURE; | ||
junr03 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
using ApiListenerPtr = std::unique_ptr<ApiListener>; | ||
using ApiListenerOptRef = absl::optional<std::reference_wrapper<ApiListener>>; | ||
|
||
} // namespace Http | ||
} // namespace Envoy |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#include "envoy/http/api_listener.h" | ||
|
||
namespace Envoy { | ||
namespace Server { | ||
|
||
/** | ||
* Listener that allows consumer to interact with Envoy via a designated API. | ||
*/ | ||
class ApiListener { | ||
public: | ||
enum class Type { HttpApiListener }; | ||
|
||
virtual ~ApiListener() = default; | ||
|
||
/** | ||
* An ApiListener is uniquely identified by its name. | ||
* | ||
* @return the name of the ApiListener. | ||
*/ | ||
virtual absl::string_view name() const PURE; | ||
|
||
/** | ||
* @return the Type of the ApiListener. | ||
*/ | ||
virtual Type type() const PURE; | ||
|
||
/** | ||
* @return valid ref IFF type() == Type::HttpApiListener, otherwise nullopt. | ||
*/ | ||
virtual Http::ApiListenerOptRef http() PURE; | ||
}; | ||
|
||
using ApiListenerPtr = std::unique_ptr<ApiListener>; | ||
using ApiListenerOptRef = absl::optional<std::reference_wrapper<ApiListener>>; | ||
|
||
} // namespace Server | ||
} // namespace Envoy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@htuch do you have any thoughts on how this type of documentation could be automatically kept up to date in the future? I'm wondering if we could somehow if a protodoc insertion point that inserts all known variants of a message or something like that. Not sure what the best thing to do here is. This will need to be kept up to date for v3 very soon for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RST anchors are automagically transformed via
protoxform
. I think we should add an annotation to support this, so thatprotoxform
can (1) do consistency checking to ensure there aren't typos and (2) automatic upgrade.