forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
listener_hooks.h
48 lines (39 loc) · 1.06 KB
/
listener_hooks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "envoy/common/pure.h"
namespace Envoy {
/**
* Hooks in the server to allow for integration testing. The real server just uses an empty
* implementation defined below.
*/
class ListenerHooks {
public:
virtual ~ListenerHooks() = default;
/**
* Called when a worker has added a listener and it is listening.
*/
virtual void onWorkerListenerAdded() PURE;
/**
* Called when a worker has removed a listener and it is no longer listening.
*/
virtual void onWorkerListenerRemoved() PURE;
/**
* Called when all workers have started.
*/
virtual void onWorkersStarted() PURE;
/**
* Called when the Runtime::ScopedLoaderSingleton is created by the server.
*/
virtual void onRuntimeCreated() PURE;
};
/**
* Empty implementation of ListenerHooks.
*/
class DefaultListenerHooks : public ListenerHooks {
public:
// ListenerHooks
void onWorkerListenerAdded() override {}
void onWorkerListenerRemoved() override {}
void onWorkersStarted() override {}
void onRuntimeCreated() override {}
};
} // namespace Envoy