Commit f1d5088b authored by Brandon Schlinker's avatar Brandon Schlinker Committed by Facebook GitHub Bot

Add function that enable all observer options for AsyncTransport

Summary: Enables an observer to automatically subscribe to all available signals.

Differential Revision: D29255979

fbshipit-source-id: 3675ef9bf2442c3b6e26c331a6089f42c1fd8ee9
parent c7400627
...@@ -876,11 +876,30 @@ class AsyncTransport : public DelayedDestruction, ...@@ -876,11 +876,30 @@ class AsyncTransport : public DelayedDestruction,
* when observers are added / removed, based on the observer configuration. * when observers are added / removed, based on the observer configuration.
*/ */
struct Config { struct Config {
virtual ~Config() = default;
// receive ByteEvents // receive ByteEvents
bool byteEvents{false}; bool byteEvents{false};
// observer is notified during prewrite stage and can add WriteFlags // observer is notified during prewrite stage and can add WriteFlags
bool prewrite{false}; bool prewrite{false};
/**
* Enable all events in config.
*/
virtual void enableAllEvents() {
byteEvents = true;
prewrite = true;
}
/**
* Returns a config where all events are enabled.
*/
static Config getConfigAllEventsEnabled() {
Config config = {};
config.enableAllEvents();
return config;
}
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment