Skip to content

Refactor Envoy's Dispatcher abstraction #14401

@akonradi

Description

@akonradi

This FR was initiated by a discussion on moving scaled timer creation into the Dispatcher interface (#13800 (comment)). I've been working on exactly that, but was having some trouble with testing that scaled timer creation was occurring without duplicating the tests for the ScaledRangeTimerManager. The problem is that ScaledRangeTimerManager is built on top of the existing Dispatcher interface. In the name of efficiency, we could merge the impl into the already-bloated dispatcher (getting rid of virtual function calls and eliminating layering concerns), but that seems counterproductive.

Instead, I'm proposing that the existing Dispatcher be split into a lower-level class that handles files, sockets, timers, and other things that deal directly with events, and an upper-level class that wraps the lower to provide nice abstractions like scaled timers, the DNS resolver, stats, and whatever else is built on top of the low-level abstractions. Implementing the high-level stuff purely in terms of the low-level abstractions makes testing easier (since we can inject mocks) and reduces the amount of code that deals directly with libevent.

@mattklein123 @htuch WDYT?

Metadata

Metadata

Labels

enhancementFeature requests. Not bugs or questions.stalestalebot believes this issue/PR has not been touched recently

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions