1818#include " ../json/ManapiJson.hpp"
1919#include " ../json/ManapiJsonMask.hpp"
2020
21- namespace manapi ::net::worker {
22- class base ;
23- class interface_worker ;
24- struct wrk_interface_global_t ;
25- }
26-
27- namespace manapi ::net::http {
28- class request ;
29- class response ;
30- class uresponse ;
31- }
32-
3321namespace manapi ::net::http {
3422 typedef std::move_only_function <future<>(manapi::net::http::request &req, manapi::net::http::response &res)> async_handler_t ;
3523
@@ -97,6 +85,7 @@ namespace manapi::net::http {
9785
9886 class site {
9987 public:
88+ struct data_t ;
10089 /* *
10190 * Compress file callback
10291 */
@@ -107,11 +96,10 @@ namespace manapi::net::http {
10796 */
10897 typedef std::move_only_function<manapi::status_or<std::string>(std::string_view data)> compress_str_cb_t ;
10998
110- typedef std::function<std::shared_ptr<worker::base>(site site, std::shared_ptr<multithread_storage::worker_t > wdata, http::config* config)> implement_create_cb;
99+ typedef std::function<std::shared_ptr<worker::base>(std::shared_ptr<net::http:: site> site, std::shared_ptr<multithread_storage::worker_t > wdata, http::config* config)> implement_create_cb;
111100
112101 typedef std::function<manapi::status_or<std::unique_ptr<worker::wrk_interface_global_t >> (worker::interface_worker *w)> implemenet_http_cb;
113102
114- struct data_t ;
115103
116104 site ();
117105 /* *
@@ -265,20 +253,27 @@ namespace manapi::net::http {
265253
266254 MANAPIHTTP_NODISCARD const std::string &config_cache_dir ();
267255
256+
257+ virtual manapi::future<manapi::status> stop () = 0;
268258 protected:
269- void init_data_ (server_ctx sctx);
259+ static std::string_view default_config_name;
260+
261+ static manapi::future<> save_config (std::shared_ptr<data_t > data);
270262
271263 static void on_config_update (std::shared_ptr<data_t > data, const manapi::json &n) MANAPIHTTP_NOEXCEPT;
272264
265+ virtual std::shared_ptr<site> copy () = 0;
266+
267+ void init_data_ (server_ctx sctx);
268+
273269 void setup ();
274270
275- manapi::future<> setup_config (manapi::json &n) ;
271+ virtual void clean_up () = 0 ;
276272
277- static manapi::future<> save_config (std::shared_ptr< data_t > data );
273+ manapi::future<> setup_config (manapi::json &n );
278274
279275 std::shared_ptr<data_t > data;
280276
281- static std::string_view default_config_name;
282277 private:
283278 static std::shared_ptr<http_handler_function> default_error_handler;
284279
0 commit comments