File indexing completed on 2026-08-17 09:00:18
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_REDIS_EXEC_FSM_HPP
0010 #define BOOST_REDIS_EXEC_FSM_HPP
0011
0012 #include <boost/redis/detail/multiplexer.hpp>
0013
0014 #include <boost/asio/cancellation_type.hpp>
0015 #include <boost/system/error_code.hpp>
0016
0017 #include <cstddef>
0018 #include <memory>
0019
0020
0021
0022 namespace boost::redis::detail {
0023
0024
0025 enum class exec_action_type
0026 {
0027 setup_cancellation,
0028 immediate,
0029 done,
0030 notify_writer,
0031 wait_for_response,
0032 };
0033
0034 class exec_action {
0035 exec_action_type type_;
0036 system::error_code ec_;
0037 std::size_t bytes_read_;
0038
0039 public:
0040 exec_action(exec_action_type type) noexcept
0041 : type_{type}
0042 { }
0043
0044 exec_action(system::error_code ec, std::size_t bytes_read = 0u) noexcept
0045 : type_{exec_action_type::done}
0046 , ec_{ec}
0047 , bytes_read_{bytes_read}
0048 { }
0049
0050 exec_action_type type() const { return type_; }
0051 system::error_code error() const { return ec_; }
0052 std::size_t bytes_read() const { return bytes_read_; }
0053 };
0054
0055 class exec_fsm {
0056 int resume_point_{0};
0057 multiplexer* mpx_{nullptr};
0058 std::shared_ptr<multiplexer::elem> elem_;
0059
0060 public:
0061 exec_fsm(multiplexer& mpx, std::shared_ptr<multiplexer::elem> elem) noexcept
0062 : mpx_(&mpx)
0063 , elem_(std::move(elem))
0064 { }
0065
0066 exec_action resume(bool connection_is_open, asio::cancellation_type_t cancel_state);
0067 };
0068
0069 }
0070
0071 #endif