NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
conn_pool.h
Go to the documentation of this file.
1
27#pragma once
28
30
31#include <asio/any_io_executor.hpp>
32#include <asio/awaitable.hpp>
33
34#include <chrono>
35#include <cstddef>
36#include <memory>
37#include <string>
38#include <string_view>
39#include <utility>
40#include <vector>
41
42namespace neograph::async {
43
44struct ConnPoolOptions {
48 std::size_t max_idle_per_host = 16;
49
52 std::chrono::seconds idle_ttl{30};
53};
54
55class NEOGRAPH_API ConnPool {
56public:
57 explicit ConnPool(asio::any_io_executor ex,
58 ConnPoolOptions opts = {});
59 ~ConnPool();
60
61 ConnPool(const ConnPool&) = delete;
62 ConnPool& operator=(const ConnPool&) = delete;
63
76 asio::awaitable<HttpResponse> async_post(
77 std::string_view host,
78 std::string_view port,
79 std::string_view path,
80 std::string_view body,
81 std::vector<std::pair<std::string, std::string>> headers = {},
82 bool tls = false,
83 RequestOptions opts = {});
84
86 std::size_t idle_count() const;
87
88private:
89 struct Impl;
90 std::unique_ptr<Impl> impl_;
91};
92
93} // namespace neograph::async
Minimal async HTTP/1.1 POST client on asio coroutines.
NEOGRAPH_API asio::awaitable< HttpResponse > async_post(asio::any_io_executor ex, std::string_view host, std::string_view port, std::string_view path, std::string_view body, std::vector< std::pair< std::string, std::string > > headers={}, bool tls=false, RequestOptions opts={})
Async HTTP(S) POST.