Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/mysql/impl/connection_pool.ipp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // Copyright (c) 2019-2025 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MYSQL_IMPL_CONNECTION_POOL_IPP
0009 #define BOOST_MYSQL_IMPL_CONNECTION_POOL_IPP
0010 
0011 #pragma once
0012 
0013 #include <boost/mysql/connection_pool.hpp>
0014 
0015 #include <boost/mysql/detail/connection_pool_fwd.hpp>
0016 
0017 #include <boost/mysql/impl/internal/connection_pool/connection_pool_impl.hpp>
0018 
0019 #include <boost/asio/any_io_executor.hpp>
0020 
0021 #include <memory>
0022 
0023 void boost::mysql::detail::return_connection(
0024     pool_impl& pool,
0025     connection_node& node,
0026     bool should_reset
0027 ) noexcept
0028 {
0029     pool.return_connection(node, should_reset);
0030 }
0031 
0032 boost::mysql::any_connection& boost::mysql::detail::get_connection(boost::mysql::detail::connection_node& node
0033 ) noexcept
0034 {
0035     return node.connection();
0036 }
0037 
0038 boost::mysql::connection_pool::connection_pool(asio::any_io_executor ex, pool_params&& params, int)
0039     : impl_(std::make_shared<detail::pool_impl>(std::move(ex), std::move(params)))
0040 {
0041 }
0042 
0043 boost::mysql::connection_pool::executor_type boost::mysql::connection_pool::get_executor() noexcept
0044 {
0045     return impl_->get_executor();
0046 }
0047 
0048 void boost::mysql::connection_pool::async_run_erased(
0049     std::shared_ptr<detail::pool_impl> pool,
0050     asio::any_completion_handler<void(error_code)> handler
0051 )
0052 {
0053     pool->async_run(std::move(handler));
0054 }
0055 
0056 void boost::mysql::connection_pool::async_get_connection_erased(
0057     std::shared_ptr<detail::pool_impl> pool,
0058     diagnostics* diag,
0059     asio::any_completion_handler<void(error_code, pooled_connection)> handler
0060 )
0061 {
0062     pool->async_get_connection(diag, std::move(handler));
0063 }
0064 
0065 void boost::mysql::connection_pool::cancel()
0066 {
0067     BOOST_ASSERT(valid());
0068     impl_->cancel();
0069 }
0070 
0071 #endif