1
#pragma once
2

            
3
namespace Envoy {
4
namespace Http {
5

            
6
// Interface for an idle session that can be terminated due to overload.
7
class IdleSessionInterface {
8
public:
9
3009
  virtual ~IdleSessionInterface() = default;
10

            
11
  // Terminates the idle session. This is called by the SessionIdleList when
12
  // the system is overloaded and the session is eligible for termination.
13
  virtual void TerminateIdleSession() = 0;
14
};
15

            
16
// Interface for managing a list of idle sessions.
17
class SessionIdleListInterface {
18
public:
19
57
  virtual ~SessionIdleListInterface() = default;
20

            
21
  // Adds a session to the idle list.
22
  virtual void AddSession(IdleSessionInterface& session) = 0;
23

            
24
  // Removes a session from the idle list.
25
  virtual void RemoveSession(IdleSessionInterface& session) = 0;
26

            
27
  // Terminates idle sessions if they are eligible for termination. This is
28
  // called by the worker thread when the system is overloaded.
29
  virtual void MaybeTerminateIdleSessions(bool is_saturated) = 0;
30
};
31

            
32
} // namespace Http
33
} // namespace Envoy