Line data Source code
1 : #pragma once 2 : 3 : #include <memory> 4 : 5 : #include "source/extensions/common/async_files/async_file_handle.h" 6 : 7 : #include "absl/status/statusor.h" 8 : 9 : namespace Envoy { 10 : namespace Extensions { 11 : namespace Common { 12 : namespace AsyncFiles { 13 : 14 : class AsyncFileAction; 15 : class AsyncFileManager; 16 : 17 : // The base implementation of an AsyncFileHandle that uses the manager thread pool - includes 18 : // all the parts that interact with the manager's thread pool. 19 : // See AsyncFileContextThreadPool for an example implementation of the actions on top of this base. 20 : class AsyncFileContextBase : public AsyncFileContext { 21 : public: 22 0 : AsyncFileManager& manager() const { return manager_; } 23 : 24 : protected: 25 : // Queue up an action with the AsyncFileManager. 26 : CancelFunction enqueue(std::shared_ptr<AsyncFileAction> action); 27 : 28 : explicit AsyncFileContextBase(AsyncFileManager& manager); 29 : 30 : protected: 31 : AsyncFileManager& manager_; 32 0 : AsyncFileHandle handle() { return shared_from_this(); } 33 : }; 34 : 35 : } // namespace AsyncFiles 36 : } // namespace Common 37 : } // namespace Extensions 38 : } // namespace Envoy