1
#pragma once
2

            
3
#include <memory>
4

            
5
#include "envoy/event/dispatcher.h"
6

            
7
#include "source/extensions/common/async_files/async_file_handle.h"
8

            
9
#include "absl/status/statusor.h"
10

            
11
namespace Envoy {
12
namespace Extensions {
13
namespace Common {
14
namespace AsyncFiles {
15

            
16
class AsyncFileAction;
17
class AsyncFileManager;
18

            
19
// The base implementation of an AsyncFileHandle that uses the manager thread pool - includes
20
// all the parts that interact with the manager's thread pool.
21
// See AsyncFileContextThreadPool for an example implementation of the actions on top of this base.
22
class AsyncFileContextBase : public AsyncFileContext {
23
public:
24
4022
  AsyncFileManager& manager() const { return manager_; }
25

            
26
protected:
27
  // Queue up an action with the AsyncFileManager.
28
  CancelFunction enqueue(Event::Dispatcher* dispatcher, std::unique_ptr<AsyncFileAction> action);
29

            
30
  explicit AsyncFileContextBase(AsyncFileManager& manager);
31

            
32
protected:
33
  AsyncFileManager& manager_;
34
3821
  AsyncFileHandle handle() { return shared_from_this(); }
35
};
36

            
37
} // namespace AsyncFiles
38
} // namespace Common
39
} // namespace Extensions
40
} // namespace Envoy