-
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
Separate out Envoy platform API from extension API #5126
Comments
I didn't realize the purpose of the API was just to provide a stable interface to extensions; I thought it also encapsulated platform functions on behalf of core code as well. If that's true should we think of a slightly different name from api/export? But +1 on separating the platform API from the additions to Envoy. In the past I've used some variation on the decorator pattern. So for Filesystem we'd have: Filesystem: abstract base class The FilesytemImpl would be contained as part of the PlatformAPI object. Alternate FilesystemImpl implementations should be straightforward to plug in (e.g. that wrap the Windows API for file i/o or provide a pure in-memory filesystem for tests). The aggregated flushing/stats-taking filesystem would be contained as part of the ExportAPI object. Similarly I think it might be interesting to take stats on threads, in which case we'd want to do it in a decorator class rather than in ThreadFactoryImpl -- which will have multiple alternate impls (eg Windows, Posix) |
Also I would propose we move TimeSystem/TimeSource into API. Many places where TImeSystem& or TimeSource& is plumbed through, API& is as well, and it would seem better to use API as a conduit. |
@jstordeur fyi |
We currently have a bit of conflation in
api/
between those APIs that are provided a platform abstraction layer (mostly for the benefit of core Envoy, but also extensions) and the APIs that will one day act as a stable interface for extensions. For example:envoy/include/envoy/api/api.h
Line 28 in 2c0733a
is clearly in the second category, and
envoy/include/envoy/api/api.h
Line 54 in 2c0733a
is in the first. This becomes even stranger when we have the
ApiImpl
require access to a stats object inenvoy/source/common/api/api_impl.h
Line 22 in 2c0733a
This is because the filesystem code is both a platform abstraction API and also providing higher level functionality like stats tracking.
Ideally, we split out the API into a
api/platform
andapi/export
, where we clearly delineate these two concerns. New platform ports of Envoy populate the interfaces inapi/platform
, extensions take dependencies onapi/export
.CC @jmarantz @eziskind @mattklein123
The text was updated successfully, but these errors were encountered: