Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/boost/http_proto/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <boost/buffers/dynamic_buffer.hpp>
#include <boost/buffers/buffer_pair.hpp>
#include <boost/core/span.hpp>
#include <boost/rts/context_fwd.hpp>
#include <boost/rts/polystore_fwd.hpp>

#include <cstddef>
#include <cstdint>
Expand Down Expand Up @@ -617,7 +617,7 @@ class parser
BOOST_HTTP_PROTO_DECL ~parser();
BOOST_HTTP_PROTO_DECL parser() noexcept;
BOOST_HTTP_PROTO_DECL parser(parser&& other) noexcept;
BOOST_HTTP_PROTO_DECL parser(rts::context const&, detail::kind);
BOOST_HTTP_PROTO_DECL parser(rts::polystore&, detail::kind);
BOOST_HTTP_PROTO_DECL void assign(parser&& other) noexcept;

BOOST_HTTP_PROTO_DECL
Expand Down Expand Up @@ -769,7 +769,7 @@ struct parser::config_base
BOOST_HTTP_PROTO_DECL
void
install_parser_service(
rts::context& ctx,
rts::polystore& ctx,
parser::config_base const& cfg);

} // http_proto
Expand Down
2 changes: 1 addition & 1 deletion include/boost/http_proto/request_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class request_parser
*/
BOOST_HTTP_PROTO_DECL
explicit
request_parser(rts::context const& ctx);
request_parser(rts::polystore& ctx);

/** Return a reference to the parsed request headers.

Expand Down
2 changes: 1 addition & 1 deletion include/boost/http_proto/response_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class response_parser
*/
BOOST_HTTP_PROTO_DECL
explicit
response_parser(rts::context const& ctx);
response_parser(rts::polystore& ctx);

/** Prepare for the next message on the stream.

Expand Down
6 changes: 3 additions & 3 deletions include/boost/http_proto/serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <boost/buffers/buffer_pair.hpp>
#include <boost/core/span.hpp>
#include <boost/rts/context_fwd.hpp>
#include <boost/rts/polystore_fwd.hpp>
#include <boost/system/result.hpp>

#include <type_traits>
Expand Down Expand Up @@ -171,7 +171,7 @@ class serializer
BOOST_HTTP_PROTO_DECL
explicit
serializer(
const rts::context& ctx);
rts::polystore& ctx);

/** Reset the serializer for a new message.

Expand Down Expand Up @@ -668,7 +668,7 @@ struct serializer::config
BOOST_HTTP_PROTO_DECL
void
install_serializer_service(
rts::context& ctx,
rts::polystore& ctx,
serializer::config const& cfg);

//------------------------------------------------
Expand Down
24 changes: 11 additions & 13 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <boost/buffers/front.hpp>
#include <boost/buffers/slice.hpp>
#include <boost/rts/brotli/decode.hpp>
#include <boost/rts/context.hpp>
#include <boost/rts/polystore.hpp>
#include <boost/rts/zlib/error.hpp>
#include <boost/rts/zlib/inflate.hpp>
#include <boost/url/grammar/ci_string.hpp>
Expand Down Expand Up @@ -309,11 +309,11 @@ class zlib_filter

public:
zlib_filter(
const rts::context& ctx,
const rts::polystore& ctx,
http_proto::detail::workspace& ws,
int window_bits)
: zlib_filter_base(ws)
, svc_(ctx.get_service<rts::zlib::inflate_service>())
, svc_(ctx.get<rts::zlib::inflate_service>())
{
system::error_code ec = static_cast<rts::zlib::error>(
svc_.init2(strm_, window_bits));
Expand Down Expand Up @@ -359,9 +359,9 @@ class brotli_filter

public:
brotli_filter(
const rts::context& ctx,
const rts::polystore& ctx,
http_proto::detail::workspace&)
: svc_(ctx.get_service<rts::brotli::decode_service>())
: svc_(ctx.get<rts::brotli::decode_service>())
{
// TODO: use custom allocator
state_ = svc_.create_instance(nullptr, nullptr, nullptr);
Expand Down Expand Up @@ -413,15 +413,13 @@ class brotli_filter
};

class parser_service
: public rts::service
{
public:
parser::config_base cfg;
std::size_t space_needed = 0;
std::size_t max_codec = 0;

parser_service(
const rts::context&,
parser::config_base const& cfg_)
: cfg(cfg_)
{
Expand Down Expand Up @@ -507,10 +505,10 @@ class parser_service

void
install_parser_service(
rts::context& ctx,
rts::polystore& ctx,
parser::config_base const& cfg)
{
ctx.make_service<parser_service>(cfg);
ctx.emplace<parser_service>(cfg);
}

//------------------------------------------------
Expand All @@ -536,7 +534,7 @@ class parser::impl
elastic,
};

const rts::context& ctx_;
const rts::polystore& ctx_;
parser_service& svc_;

detail::workspace ws_;
Expand Down Expand Up @@ -569,9 +567,9 @@ class parser::impl
bool chunked_body_ended;

public:
impl(const rts::context& ctx, detail::kind k)
impl(const rts::polystore& ctx, detail::kind k)
: ctx_(ctx)
, svc_(ctx.get_service<parser_service>())
, svc_(ctx.get<parser_service>())
, ws_(svc_.space_needed)
, m_(ws_.data(), ws_.size())
, state_(state::reset)
Expand Down Expand Up @@ -1868,7 +1866,7 @@ parser(parser&& other) noexcept

parser::
parser(
rts::context const& ctx,
rts::polystore& ctx,
detail::kind k)
: impl_(new impl(ctx, k))
{
Expand Down
2 changes: 1 addition & 1 deletion src/request_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace http_proto {

request_parser::
request_parser(
const rts::context& ctx)
rts::polystore& ctx)
: parser(
ctx,
detail::kind::request)
Expand Down
2 changes: 1 addition & 1 deletion src/response_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace http_proto {

response_parser::
response_parser(
const rts::context& ctx)
rts::polystore& ctx)
: parser(
ctx,
detail::kind::response)
Expand Down
24 changes: 11 additions & 13 deletions src/serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <boost/core/bit.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/rts/brotli/encode.hpp>
#include <boost/rts/context.hpp>
#include <boost/rts/polystore.hpp>
#include <boost/rts/zlib/compression_method.hpp>
#include <boost/rts/zlib/compression_strategy.hpp>
#include <boost/rts/zlib/deflate.hpp>
Expand Down Expand Up @@ -94,13 +94,13 @@ class zlib_filter

public:
zlib_filter(
const rts::context& ctx,
const rts::polystore& ctx,
http_proto::detail::workspace& ws,
int comp_level,
int window_bits,
int mem_level)
: zlib_filter_base(ws)
, svc_(ctx.get_service<rts::zlib::deflate_service>())
, svc_(ctx.get<rts::zlib::deflate_service>())
{
system::error_code ec = static_cast<rts::zlib::error>(svc_.init2(
strm_,
Expand Down Expand Up @@ -160,11 +160,11 @@ class brotli_filter

public:
brotli_filter(
const rts::context& ctx,
const rts::polystore& ctx,
http_proto::detail::workspace&,
std::uint32_t comp_quality,
std::uint32_t comp_window)
: svc_(ctx.get_service<rts::brotli::encode_service>())
: svc_(ctx.get<rts::brotli::encode_service>())
{
// TODO: use custom allocator
state_ = svc_.create_instance(nullptr, nullptr, nullptr);
Expand Down Expand Up @@ -231,14 +231,12 @@ clamp(
}

class serializer_service
: public rts::service
{
public:
serializer::config cfg;
std::size_t space_needed = 0;

serializer_service(
const rts::context&,
serializer::config const& cfg_)
: cfg(cfg_)
{
Expand Down Expand Up @@ -269,10 +267,10 @@ class serializer_service

void
install_serializer_service(
rts::context& ctx,
rts::polystore& ctx,
serializer::config const& cfg)
{
ctx.make_service<serializer_service>(cfg);
ctx.emplace<serializer_service>(cfg);
}

//------------------------------------------------
Expand All @@ -297,7 +295,7 @@ class serializer::impl
stream
};

const rts::context& ctx_;
const rts::polystore& ctx_;
serializer_service& svc_;
detail::workspace ws_;

Expand All @@ -319,9 +317,9 @@ class serializer::impl
bool filter_done_ = false;

public:
impl(const rts::context& ctx)
impl(const rts::polystore& ctx)
: ctx_(ctx)
, svc_(ctx_.get_service<serializer_service>())
, svc_(ctx_.get<serializer_service>())
, ws_(svc_.space_needed)
{
}
Expand Down Expand Up @@ -957,7 +955,7 @@ operator=(serializer&& other) noexcept
}

serializer::
serializer(rts::context const& ctx)
serializer(rts::polystore& ctx)
: impl_(new impl(ctx))
{
// TODO: use a single allocation for
Expand Down
18 changes: 9 additions & 9 deletions test/unit/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <boost/core/detail/string_view.hpp>
#include <boost/core/span.hpp>
#include <boost/rts/brotli.hpp>
#include <boost/rts/context.hpp>
#include <boost/rts/polystore.hpp>
#include <boost/rts/zlib.hpp>

#include "test_helpers.hpp"
Expand Down Expand Up @@ -55,7 +55,7 @@ struct zlib_test
static
std::string
compress(
const rts::context& ctx,
const rts::polystore& ctx,
core::string_view encoding,
core::string_view body)
{
Expand All @@ -65,7 +65,7 @@ struct zlib_test
if(encoding == "deflate" || encoding == "gzip")
{
namespace zlib = rts::zlib;
auto& svc = ctx.get_service<zlib::deflate_service>();
auto& svc = ctx.get<zlib::deflate_service>();
zlib::stream zs{};

auto ret = static_cast<zlib::error>(
Expand Down Expand Up @@ -101,7 +101,7 @@ struct zlib_test
else if(encoding == "br")
{
namespace brotli = rts::brotli;
auto& svc = ctx.get_service<brotli::encode_service>();
auto& svc = ctx.get<brotli::encode_service>();

brotli::encoder_state* state =
svc.create_instance(nullptr, nullptr, nullptr);
Expand Down Expand Up @@ -145,15 +145,15 @@ struct zlib_test
static
void
verify_compressed(
const rts::context& ctx,
const rts::polystore& ctx,
core::string_view encoding,
core::string_view compressed_body,
core::string_view body)
{
if(encoding == "deflate" || encoding == "gzip")
{
namespace zlib = rts::zlib;
auto& svc = ctx.get_service<zlib::inflate_service>();
auto& svc = ctx.get<zlib::inflate_service>();
zlib::stream zs{};

auto ret = static_cast<zlib::error>(
Expand Down Expand Up @@ -192,7 +192,7 @@ struct zlib_test
else if(encoding == "br")
{
namespace brotli = rts::brotli;
auto& svc = ctx.get_service<brotli::decode_service>();
auto& svc = ctx.get<brotli::decode_service>();

brotli::decoder_state* state =
svc.create_instance(nullptr, nullptr, nullptr);
Expand Down Expand Up @@ -376,7 +376,7 @@ struct zlib_test
void
test_serializer()
{
rts::context ctx;
rts::polystore ctx;
std::vector<std::string> encodings;
serializer::config cfg;

Expand Down Expand Up @@ -612,7 +612,7 @@ struct zlib_test
void
test_parser()
{
rts::context ctx;
rts::polystore ctx;
std::vector<std::string> encodings;
response_parser::config cfg;

Expand Down
Loading
Loading