Skip to content

Commit fb169eb

Browse files
committed
application, datastore, polystore imported from Capy
1 parent 4851988 commit fb169eb

41 files changed

Lines changed: 1816 additions & 119 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/boost/http/application.hpp

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//
2+
// Copyright (c) 2022 Vinnie Falco (vinnie dot falco at gmail dot com)
3+
//
4+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
//
7+
// Official repository: https://github.com/cppalliance/http
8+
//
9+
10+
#ifndef BOOST_HTTP_APPLICATION_HPP
11+
#define BOOST_HTTP_APPLICATION_HPP
12+
13+
#include <boost/http/detail/config.hpp>
14+
#include <boost/http/core/polystore.hpp>
15+
#include <memory>
16+
#include <type_traits>
17+
18+
namespace boost {
19+
namespace http {
20+
21+
/** A collection of type-erased parts and process state
22+
23+
An object of this type holds a collection of type-erased parts,
24+
where each part undergoes two-phase initialization. First the part is
25+
constructed by calling @ref emplace. The @ref start function invokes
26+
`start()` on each part. When @ref stop is called, each part has its
27+
`stop()` member invoked. And when the application object is destroyed,
28+
all the parts are destroyed in reverse order of construction.
29+
*/
30+
class BOOST_HTTP_SYMBOL_VISIBLE
31+
application : public http::polystore
32+
{
33+
public:
34+
application(application const&) = delete;
35+
application& operator=(application const&) = delete;
36+
37+
/** Destructor
38+
39+
All stored objects will be destroyed in the reverse order of creation.
40+
*/
41+
BOOST_HTTP_DECL
42+
~application();
43+
44+
/** Constructor
45+
*/
46+
BOOST_HTTP_DECL
47+
application();
48+
49+
/** Invoke `start` on each part in creation order
50+
Each call is performed synchronously; this function blocks until each
51+
part returns. Only one invocation of `start` is permitted.
52+
*/
53+
BOOST_HTTP_DECL
54+
void start();
55+
56+
/** Invoke `stop` on each part in reverse creation order
57+
This function is idempotent and returns immediately.
58+
@par Thread Safety
59+
May be called concurrently.
60+
*/
61+
BOOST_HTTP_DECL
62+
void stop();
63+
64+
/** Wait until the application is stopped
65+
*/
66+
BOOST_HTTP_DECL
67+
void join();
68+
69+
private:
70+
enum state : char;
71+
struct impl;
72+
impl* impl_;
73+
};
74+
75+
} // http
76+
} // boost
77+
78+
#endif

include/boost/http/brotli.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
2121
@code
2222
#include <boost/http/brotli.hpp>
23-
#include <boost/capy/datastore.hpp>
23+
#include <boost/http/datastore.hpp>
2424
2525
// Create a datastore for services
26-
boost::capy::datastore ctx;
26+
boost::http::datastore ctx;
2727
2828
// Install compression and decompression services
2929
auto& encoder = boost::http::brotli::install_encode_service(ctx);

include/boost/http/brotli/decode.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ using metadata_chunk_func = void (*)(void* opaque, const std::uint8_t* data, std
7171
7272
@code
7373
// Example: Simple one-shot decompression
74-
boost::capy::datastore ctx;
74+
boost::http::datastore ctx;
7575
auto& decoder = boost::http::brotli::install_decode_service(ctx);
7676
7777
std::vector<std::uint8_t> compressed_data = get_compressed_data();
@@ -249,7 +249,7 @@ struct BOOST_SYMBOL_VISIBLE
249249
*/
250250
BOOST_HTTP_DECL
251251
decode_service&
252-
install_decode_service(capy::polystore& ctx);
252+
install_decode_service(http::polystore& ctx);
253253

254254
} // brotli
255255
} // http

include/boost/http/brotli/encode.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ enum constants
153153
154154
@code
155155
// Example: Simple one-shot compression
156-
boost::capy::datastore ctx;
156+
boost::http::datastore ctx;
157157
auto& encoder = boost::http::brotli::install_encode_service(ctx);
158158
159159
std::vector<std::uint8_t> input_data = get_input_data();
@@ -353,7 +353,7 @@ struct BOOST_SYMBOL_VISIBLE
353353
*/
354354
BOOST_HTTP_DECL
355355
encode_service&
356-
install_encode_service(capy::polystore& ctx);
356+
install_encode_service(http::polystore& ctx);
357357

358358
} // brotli
359359
} // http

include/boost/http/brotli/shared_dictionary.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <boost/http/detail/config.hpp>
1414
#include <boost/http/brotli/types.hpp>
15-
#include <boost/capy/core/polystore_fwd.hpp>
15+
#include <boost/http/core/polystore_fwd.hpp>
1616

1717
namespace boost {
1818
namespace http {
@@ -69,7 +69,7 @@ struct BOOST_SYMBOL_VISIBLE
6969
*/
7070
BOOST_HTTP_DECL
7171
shared_dictionary_service&
72-
install_shared_dictionary_service(capy::polystore& ctx);
72+
install_shared_dictionary_service(http::polystore& ctx);
7373

7474
} // brotli
7575
} // http

0 commit comments

Comments
 (0)