Merge pull request #60 from oatpp/minor_async_apis_improvements

rename coroutine start methods
This commit is contained in:
Leonid Stryzhevskyi 2019-04-05 01:50:36 +03:00 committed by GitHub
commit b0fa7aff34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 159 additions and 160 deletions

View File

@ -218,7 +218,7 @@ static PathPattern Z_getPathPattern_##NAME(const oatpp::String& path) { \
return pattern; \
} \
\
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::web::protocol::http::incoming::Response>&> NAME( \
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::web::protocol::http::incoming::Response>&> NAME( \
const std::shared_ptr<oatpp::web::client::RequestExecutor::ConnectionHandle>& __connectionHandle = nullptr \
) { \
std::shared_ptr<oatpp::web::protocol::http::outgoing::Body> body; \
@ -237,7 +237,7 @@ static PathPattern Z_getPathPattern_##NAME(const oatpp::String& path) { \
return pattern; \
} \
\
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::web::protocol::http::incoming::Response>&> NAME(\
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::web::protocol::http::incoming::Response>&> NAME(\
OATPP_MACRO_FOREACH(OATPP_MACRO_API_CLIENT_PARAM_DECL, LIST) \
const std::shared_ptr<oatpp::web::client::RequestExecutor::ConnectionHandle>& __connectionHandle = nullptr \
) { \
@ -264,7 +264,7 @@ oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::web::protocol:
* @param METHOD - Http method ("GET", "POST", "PUT", etc.)
* @param PATH - Path to endpoint (without host)
* @param NAME - Name of the generated method
* @return - &id:oatpp::async::CoroutineCallForResult;<const std::shared_ptr<&id:oatpp::web::protocol::http::incoming::Response;>&>.
* @return - &id:oatpp::async::CoroutineStarterForResult;<const std::shared_ptr<&id:oatpp::web::protocol::http::incoming::Response;>&>.
*/
#define API_CALL_ASYNC(METHOD, PATH, NAME, ...) \
OATPP_API_CALL_ASYNC___(NAME, METHOD, PATH, (__VA_ARGS__))

View File

@ -473,10 +473,10 @@ const std::shared_ptr<Endpoint> Z__ENDPOINT_##NAME = createEndpoint(m_endpoints,
OATPP_MACRO_API_CONTROLLER_ENDPOINT_ASYNC_DECL_DEFAULTS(NAME, METHOD, PATH) \
OATPP_MACRO_API_CONTROLLER_ENDPOINT_ASYNC_DECL(NAME, METHOD, PATH) \
\
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::web::protocol::http::outgoing::Response>&> \
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::web::protocol::http::outgoing::Response>&> \
Z__PROXY_METHOD_##NAME(const std::shared_ptr<oatpp::web::protocol::http::incoming::Request>& __request) \
{ \
return NAME::callForResult(this, __request); \
return NAME::startForResult(this, __request); \
} \
\
class NAME : public HandlerCoroutine<NAME, __ControllerType>

View File

@ -81,14 +81,14 @@ v_int32 Action::getType() {
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Pipeline
// CoroutineStarter
Pipeline::Pipeline(AbstractCoroutine* coroutine)
CoroutineStarter::CoroutineStarter(AbstractCoroutine* coroutine)
: m_first(coroutine)
, m_last(coroutine)
{}
Pipeline::Pipeline(Pipeline&& other)
CoroutineStarter::CoroutineStarter(CoroutineStarter&& other)
: m_first(other.m_first)
, m_last(other.m_last)
{
@ -96,7 +96,7 @@ Pipeline::Pipeline(Pipeline&& other)
other.m_last = nullptr;
}
Pipeline::~Pipeline() {
CoroutineStarter::~CoroutineStarter() {
if(m_first != nullptr) {
auto curr = m_first;
while(curr != nullptr) {
@ -113,7 +113,7 @@ Pipeline::~Pipeline() {
/*
* Move assignment operator.
*/
Pipeline& Pipeline::operator=(Pipeline&& other) {
CoroutineStarter& CoroutineStarter::operator=(CoroutineStarter&& other) {
m_first = other.m_first;
m_last = other.m_last;
other.m_first = nullptr;
@ -121,7 +121,7 @@ Pipeline& Pipeline::operator=(Pipeline&& other) {
return *this;
}
Action Pipeline::next(Action&& action) {
Action CoroutineStarter::next(Action&& action) {
if(m_last == nullptr) {
return std::forward<Action>(action);
}
@ -132,7 +132,7 @@ Action Pipeline::next(Action&& action) {
return std::move(result);
}
Pipeline& Pipeline::next(Pipeline&& starter) {
CoroutineStarter& CoroutineStarter::next(CoroutineStarter&& starter) {
m_last->m_parentReturnAction = starter.m_first;
m_last = starter.m_last;
starter.m_first = nullptr;

View File

@ -38,7 +38,7 @@ namespace oatpp { namespace async {
class AbstractCoroutine; // FWD
class Processor; // FWD
class Pipeline; // FWD
class CoroutineStarter; // FWD
/**
* Class Action represents an asynchronous action.
@ -46,7 +46,7 @@ class Pipeline; // FWD
class Action {
friend Processor;
friend AbstractCoroutine;
friend Pipeline;
friend CoroutineStarter;
public:
typedef Action (AbstractCoroutine::*FunctionPtr)();
public:
@ -150,9 +150,9 @@ public:
};
/**
* Pipeline of Coroutine calls.
* CoroutineStarter of Coroutine calls.
*/
class Pipeline {
class CoroutineStarter {
private:
AbstractCoroutine* m_first;
AbstractCoroutine* m_last;
@ -162,47 +162,47 @@ public:
* Constructor.
* @param coroutine - coroutine.
*/
Pipeline(AbstractCoroutine* coroutine);
CoroutineStarter(AbstractCoroutine* coroutine);
/**
* Deleted copy-constructor.
*/
Pipeline(const Pipeline&) = delete;
CoroutineStarter(const CoroutineStarter&) = delete;
/**
* Move constructor.
* @param other - other pipeline.
* @param other - other starter.
*/
Pipeline(Pipeline&& other);
CoroutineStarter(CoroutineStarter&& other);
/**
* Non-virtual destructor.
*/
~Pipeline();
~CoroutineStarter();
/*
* Deleted copy-assignment operator.
*/
Pipeline& operator=(const Pipeline&) = delete;
CoroutineStarter& operator=(const CoroutineStarter&) = delete;
/*
* Move assignment operator.
*/
Pipeline& operator=(Pipeline&& other);
CoroutineStarter& operator=(CoroutineStarter&& other);
/**
* Set final pipeline action.
* Set final starter action.
* @param action - &l:Action;.
* @return - &l:Action;.
*/
Action next(Action&& action);
/**
* Add coroutine pipeline to this pipeline.
* Add coroutine starter pipeline to this starter.
* @param pipeline - pipeline to add.
* @return - this pipeline.
*/
Pipeline& next(Pipeline&& pipeline);
CoroutineStarter& next(CoroutineStarter&& starter);
};
@ -212,7 +212,7 @@ public:
class AbstractCoroutine {// : public oatpp::base::Countable {
friend oatpp::collection::FastQueue<AbstractCoroutine>;
friend Processor;
friend Pipeline;
friend CoroutineStarter;
public:
/**
* Convenience typedef for Action
@ -303,18 +303,6 @@ public:
return getMemberCaller().call<Action>(ptr, args...);
}
/**
* Start new Coroutine as a "nested" Coroutine, keeping track of a coroutine call stack.
* @tparam C - Coroutine to start.
* @tparam Args - arguments to be passed to a starting coroutine.
* @param args - actual parameters passed to startCoroutine call.
* @return - &l:Pipeline; of coroutine calls.
*/
template<typename C, typename ... Args>
static Pipeline startCoroutine(Args... args) {
return Pipeline(new C(args...));
}
/**
* Check if coroutine is finished
* @return - true if finished
@ -364,6 +352,17 @@ public:
public:
/**
* Create coroutine and return it's starter
* @tparam ConstructorArgs - coroutine constructor arguments.
* @param args - actual coroutine constructor arguments.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
template<typename ...ConstructorArgs>
static CoroutineStarter start(ConstructorArgs... args) {
return new T(args...);
}
/**
* Call function of Coroutine specified by ptr. <br>
* Overridden `AbstractCoroutine::call()` method.
@ -423,7 +422,7 @@ public:
* Class representing Coroutine call for result;
*/
template<typename ...Args >
class CallForResult {
class StarterForResult {
public:
template <class C>
@ -437,20 +436,20 @@ public:
* Constructor.
* @param coroutine - coroutine.
*/
CallForResult(AbstractCoroutineWithResult* coroutine)
StarterForResult(AbstractCoroutineWithResult* coroutine)
: m_coroutine(coroutine)
{}
/**
* Deleted copy-constructor.
*/
CallForResult(const CallForResult&) = delete;
StarterForResult(const StarterForResult&) = delete;
/**
* Move constructor.
* @param other - other pipeline.
*/
CallForResult(CallForResult&& other)
StarterForResult(StarterForResult&& other)
: m_coroutine(other.m_coroutine)
{
other.m_coroutine = nullptr;
@ -459,7 +458,7 @@ public:
/**
* Non-virtual destructor.
*/
~CallForResult() {
~StarterForResult() {
if(m_coroutine != nullptr) {
delete m_coroutine;
}
@ -468,12 +467,12 @@ public:
/*
* Deleted copy-assignment operator.
*/
CallForResult& operator=(const CallForResult&) = delete;
StarterForResult& operator=(const StarterForResult&) = delete;
/*
* Move assignment operator.
*/
CallForResult& operator=(CallForResult&& other) {
StarterForResult& operator=(StarterForResult&& other) {
m_coroutine = other.m_coroutine;
other.m_coroutine = nullptr;
return *this;
@ -482,7 +481,7 @@ public:
template<class C>
Action callbackTo(Callback<C> callback) {
if(m_coroutine == nullptr) {
throw std::runtime_error("[oatpp::async::AbstractCoroutineWithResult::CallForResult::callbackTo()]: Error. Coroutine is null.");
throw std::runtime_error("[oatpp::async::AbstractCoroutineWithResult::StarterForResult::callbackTo()]: Error. Coroutine is null.");
}
m_coroutine->m_callback = (FunctionPtr)(callback);
Action result = m_coroutine;
@ -497,7 +496,7 @@ public:
template <typename ...Args>
using
CoroutineCallForResult = typename AbstractCoroutineWithResult::CallForResult<Args...>;
CoroutineStarterForResult = typename AbstractCoroutineWithResult::StarterForResult<Args...>;
/**
* Coroutine with result template. <br>
@ -529,7 +528,7 @@ public:
* @return - &l:CoroutineWithResult::CoroutineWithResult;.
*/
template<typename ...ConstructorArgs>
static CoroutineCallForResult<Args...> callForResult(ConstructorArgs... args) {
static CoroutineStarterForResult<Args...> startForResult(ConstructorArgs... args) {
return new T(args...);
}

View File

@ -286,7 +286,7 @@ data::v_io_size FIFOBuffer::flushToStream(data::stream::OutputStream& stream) {
}
async::Pipeline FIFOBuffer::flushToStreamAsync(const std::shared_ptr<data::stream::OutputStream>& stream)
async::CoroutineStarter FIFOBuffer::flushToStreamAsync(const std::shared_ptr<data::stream::OutputStream>& stream)
{
class FlushCoroutine : public oatpp::async::Coroutine<FlushCoroutine> {
@ -352,7 +352,7 @@ async::Pipeline FIFOBuffer::flushToStreamAsync(const std::shared_ptr<data::strea
};
return oatpp::async::AbstractCoroutine::startCoroutine<FlushCoroutine>(shared_from_this(), stream);
return FlushCoroutine::start(shared_from_this(), stream);
}

View File

@ -127,9 +127,9 @@ public:
/**
* flush all availableToRead bytes to stream in asynchronous manner
* @param stream - &id:data::stream::OutputStream;.
* @return - &id:async::Pipeline;.
* @return - &id:async::CoroutineStarter;.
*/
async::Pipeline flushToStreamAsync(const std::shared_ptr<data::stream::OutputStream>& stream);
async::CoroutineStarter flushToStreamAsync(const std::shared_ptr<data::stream::OutputStream>& stream);
};

View File

@ -224,7 +224,7 @@ bool ChunkedBuffer::flushToStream(const std::shared_ptr<OutputStream>& stream){
return true;
}
oatpp::async::Pipeline ChunkedBuffer::flushToStreamAsync(const std::shared_ptr<OutputStream>& stream) {
oatpp::async::CoroutineStarter ChunkedBuffer::flushToStreamAsync(const std::shared_ptr<OutputStream>& stream) {
class FlushCoroutine : public oatpp::async::Coroutine<FlushCoroutine> {
private:
@ -278,7 +278,7 @@ oatpp::async::Pipeline ChunkedBuffer::flushToStreamAsync(const std::shared_ptr<O
};
return oatpp::async::AbstractCoroutine::startCoroutine<FlushCoroutine>(shared_from_this(), stream);
return FlushCoroutine::start(shared_from_this(), stream);
}

View File

@ -206,9 +206,9 @@ public:
/**
* Write all data from ChunkedBuffer to &id:oatpp::data::stream::OutputStream; in asynchronous manner.
* @param stream - &id:oatpp::data::stream::OutputStream; stream to write all data to.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
oatpp::async::Pipeline flushToStreamAsync(const std::shared_ptr<OutputStream>& stream);
oatpp::async::CoroutineStarter flushToStreamAsync(const std::shared_ptr<OutputStream>& stream);
std::shared_ptr<Chunks> getChunks();

View File

@ -208,10 +208,10 @@ oatpp::data::v_io_size transfer(const std::shared_ptr<InputStream>& fromStream,
}
oatpp::async::Pipeline transferAsync(const std::shared_ptr<InputStream>& fromStream,
const std::shared_ptr<OutputStream>& toStream,
oatpp::data::v_io_size transferSize,
const std::shared_ptr<oatpp::data::buffer::IOBuffer>& buffer) {
oatpp::async::CoroutineStarter transferAsync(const std::shared_ptr<InputStream>& fromStream,
const std::shared_ptr<OutputStream>& toStream,
oatpp::data::v_io_size transferSize,
const std::shared_ptr<oatpp::data::buffer::IOBuffer>& buffer) {
class TransferCoroutine : public oatpp::async::Coroutine<TransferCoroutine> {
private:
@ -286,7 +286,7 @@ oatpp::async::Pipeline transferAsync(const std::shared_ptr<InputStream>& fromStr
};
return oatpp::async::AbstractCoroutine::startCoroutine<TransferCoroutine>(fromStream, toStream, transferSize, buffer);
return TransferCoroutine::start(fromStream, toStream, transferSize, buffer);
}

View File

@ -216,7 +216,7 @@ oatpp::data::v_io_size transfer(const std::shared_ptr<InputStream>& fromStream,
/**
* Same as transfer but asynchronous
*/
oatpp::async::Pipeline transferAsync(const std::shared_ptr<InputStream>& fromStream,
oatpp::async::CoroutineStarter transferAsync(const std::shared_ptr<InputStream>& fromStream,
const std::shared_ptr<OutputStream>& toStream,
oatpp::data::v_io_size transferSize,
const std::shared_ptr<oatpp::data::buffer::IOBuffer>& buffer);

View File

@ -42,7 +42,7 @@ data::v_io_size OutputStreamBufferedProxy::flush() {
return m_buffer->flushToStream(*m_outputStream);
}
oatpp::async::Pipeline OutputStreamBufferedProxy::flushAsync() {
oatpp::async::CoroutineStarter OutputStreamBufferedProxy::flushAsync() {
return m_buffer->flushToStreamAsync(m_outputStream);
}

View File

@ -74,7 +74,7 @@ public:
data::v_io_size write(const void *data, data::v_io_size count) override;
data::v_io_size flush();
oatpp::async::Pipeline flushAsync();
oatpp::async::CoroutineStarter flushAsync();
void setBufferPosition(data::v_io_size readPosition, data::v_io_size writePosition, bool canRead) {
m_buffer->setBufferPosition(readPosition, writePosition, canRead);

View File

@ -85,9 +85,9 @@ public:
/**
* Implement this method.
* Obtain IOStream representing connection to resource.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
virtual oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() = 0;
virtual oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() = 0;
/**
* Should close all handles here.

View File

@ -84,7 +84,7 @@ std::shared_ptr<oatpp::data::stream::IOStream> SimpleTCPConnectionProvider::getC
}
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> SimpleTCPConnectionProvider::getConnectionAsync() {
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> SimpleTCPConnectionProvider::getConnectionAsync() {
class ConnectCoroutine : public oatpp::async::CoroutineWithResult<ConnectCoroutine, const std::shared_ptr<oatpp::data::stream::IOStream>&> {
private:
@ -188,7 +188,7 @@ oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::
};
return ConnectCoroutine::callForResult(m_host, m_port);
return ConnectCoroutine::startForResult(m_host, m_port);
}

View File

@ -73,9 +73,9 @@ public:
/**
* Get connection in asynchronous manner.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override;
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override;
/**
* Get host name.

View File

@ -87,7 +87,7 @@ public:
* <br>
* *It may be implemented later*
*/
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override {
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override {
/*
* No need to implement this.
* For Asynchronous IO in oatpp it is considered to be a good practice

View File

@ -51,7 +51,7 @@ std::shared_ptr<ConnectionProvider::IOStream> ConnectionProvider::getConnection(
return socket;
}
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> ConnectionProvider::getConnectionAsync() {
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> ConnectionProvider::getConnectionAsync() {
class ConnectCoroutine : public oatpp::async::CoroutineWithResult<ConnectCoroutine, const std::shared_ptr<oatpp::data::stream::IOStream>&> {
private:
@ -98,7 +98,7 @@ oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::
};
return ConnectCoroutine::callForResult(m_interface, m_maxAvailableToRead, m_maxAvailableToWrite);
return ConnectCoroutine::startForResult(m_interface, m_maxAvailableToRead, m_maxAvailableToWrite);
}

View File

@ -79,9 +79,9 @@ public:
/**
* Get connection in asynchronous manner.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override;
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override;
};

View File

@ -87,7 +87,7 @@ public:
* <br>
* *It may be implemented later.*
*/
oatpp::async::CoroutineCallForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override {
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<oatpp::data::stream::IOStream>&> getConnectionAsync() override {
/*
* No need to implement this.
* For Asynchronous IO in oatpp it is considered to be a good practice

View File

@ -142,7 +142,7 @@ std::shared_ptr<RequestExecutor::ConnectionHandle> ApiClient::getConnection() {
return m_requestExecutor->getConnection();
}
oatpp::async::CoroutineCallForResult<const std::shared_ptr<RequestExecutor::ConnectionHandle>&> ApiClient::getConnectionAsync() {
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<RequestExecutor::ConnectionHandle>&> ApiClient::getConnectionAsync() {
return m_requestExecutor->getConnectionAsync();
}
@ -164,7 +164,7 @@ std::shared_ptr<ApiClient::Response> ApiClient::executeRequest(const oatpp::Stri
}
oatpp::async::CoroutineCallForResult<const std::shared_ptr<ApiClient::Response>&>
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<ApiClient::Response>&>
ApiClient::executeRequestAsync(const oatpp::String& method,
const PathPattern& pathPattern,
const std::shared_ptr<StringToParamMap>& headers,

View File

@ -188,9 +188,9 @@ public:
/**
* Call &id:oatpp::web::client::RequestExecutor::getConnectionAsync;.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
virtual oatpp::async::CoroutineCallForResult<const std::shared_ptr<RequestExecutor::ConnectionHandle>&> getConnectionAsync();
virtual oatpp::async::CoroutineStarterForResult<const std::shared_ptr<RequestExecutor::ConnectionHandle>&> getConnectionAsync();
virtual std::shared_ptr<Response> executeRequest(const oatpp::String& method,
@ -201,7 +201,7 @@ public:
const std::shared_ptr<RequestExecutor::Body>& body,
const std::shared_ptr<RequestExecutor::ConnectionHandle>& connectionHandle = nullptr);
virtual oatpp::async::CoroutineCallForResult<const std::shared_ptr<Response>&>
virtual oatpp::async::CoroutineStarterForResult<const std::shared_ptr<Response>&>
executeRequestAsync(const oatpp::String& method,
const PathPattern& pathPattern,
const std::shared_ptr<StringToParamMap>& headers,

View File

@ -63,7 +63,7 @@ std::shared_ptr<HttpRequestExecutor::ConnectionHandle> HttpRequestExecutor::getC
return std::make_shared<HttpConnectionHandle>(connection);
}
oatpp::async::CoroutineCallForResult<const std::shared_ptr<HttpRequestExecutor::ConnectionHandle>&>
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<HttpRequestExecutor::ConnectionHandle>&>
HttpRequestExecutor::getConnectionAsync() {
class GetConnectionCoroutine : public oatpp::async::CoroutineWithResult<GetConnectionCoroutine, const std::shared_ptr<ConnectionHandle>&> {
@ -85,7 +85,7 @@ HttpRequestExecutor::getConnectionAsync() {
};
return GetConnectionCoroutine::callForResult(m_connectionProvider);
return GetConnectionCoroutine::startForResult(m_connectionProvider);
}
@ -144,7 +144,7 @@ HttpRequestExecutor::execute(const String& method,
}
oatpp::async::CoroutineCallForResult<const std::shared_ptr<HttpRequestExecutor::Response>&>
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<HttpRequestExecutor::Response>&>
HttpRequestExecutor::executeAsync(const String& method,
const String& path,
const Headers& headers,
@ -227,7 +227,7 @@ HttpRequestExecutor::executeAsync(const String& method,
};
return ExecutorCoroutine::callForResult(m_connectionProvider, method, path, headers, body, m_bodyDecoder, connectionHandle);
return ExecutorCoroutine::startForResult(m_connectionProvider, method, path, headers, body, m_bodyDecoder, connectionHandle);
}

View File

@ -93,9 +93,9 @@ public:
/**
* Same as &l:HttpRequestExecutor::getConnection (); but async.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const std::shared_ptr<HttpRequestExecutor::ConnectionHandle>&> getConnectionAsync() override;
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<HttpRequestExecutor::ConnectionHandle>&> getConnectionAsync() override;
/**
* Execute http request.
@ -120,9 +120,9 @@ public:
* @param headers - headers map &id:oatpp::web::client::RequestExecutor::Headers;.
* @param body - `std::shared_ptr` to &id:oatpp::web::client::RequestExecutor::Body; object.
* @param connectionHandle - ConnectionHandle obtain in call to &l:HttpRequestExecutor::getConnection ();.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const std::shared_ptr<Response>&>
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<Response>&>
executeAsync(const String& method,
const String& path,
const Headers& headers,

View File

@ -160,9 +160,9 @@ public:
/**
* Same as &l:RequestExecutor::getConnection (); but Async.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
virtual oatpp::async::CoroutineCallForResult<const std::shared_ptr<ConnectionHandle>&> getConnectionAsync() = 0;
virtual oatpp::async::CoroutineStarterForResult<const std::shared_ptr<ConnectionHandle>&> getConnectionAsync() = 0;
/**
* Execute request.
@ -186,9 +186,9 @@ public:
* @param headers - headers map &l:RequestExecutor::Headers;.
* @param body - `std::shared_ptr` to &l:RequestExecutor::Body; object.
* @param connectionHandle - &l:RequestExecutor::ConnectionHandle;.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
virtual oatpp::async::CoroutineCallForResult<const std::shared_ptr<Response>&>
virtual oatpp::async::CoroutineStarterForResult<const std::shared_ptr<Response>&>
executeAsync(const String& method,
const String& path,
const Headers& headers,

View File

@ -115,11 +115,11 @@ public:
* @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;.
* @param bodyStream - `std::shared_ptr` to &id:oatpp::data::stream::InputStream;.
* @param toStream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
virtual oatpp::async::Pipeline decodeAsync(const Headers& headers,
const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const = 0;
virtual oatpp::async::CoroutineStarter decodeAsync(const Headers& headers,
const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const = 0;
/**
* Read body stream and decode it to string.
@ -153,11 +153,11 @@ public:
* Same as &l:BodyDecoder::decodeToString (); but Async.
* @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;.
* @param bodyStream - `std::shared_ptr` to &id:oatpp::data::stream::InputStream;.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const oatpp::String&>
oatpp::async::CoroutineStarterForResult<const oatpp::String&>
decodeToStringAsync(const Headers& headers, const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream) const {
return ToStringDecoder::callForResult(this, headers, bodyStream);
return ToStringDecoder::startForResult(this, headers, bodyStream);
}
/**
@ -166,14 +166,14 @@ public:
* @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;.
* @param bodyStream - `std::shared_ptr` to &id:oatpp::data::stream::InputStream;.
* @param objectMapper - `std::shared_ptr` to &id:oatpp::data::mapping::ObjectMapper;.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
template<class DtoType>
oatpp::async::CoroutineCallForResult<const typename DtoType::ObjectWrapper&>
oatpp::async::CoroutineStarterForResult<const typename DtoType::ObjectWrapper&>
decodeToDtoAsync(const Headers& headers,
const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& objectMapper) const {
return ToDtoDecoder<DtoType>::callForResult(this, headers, bodyStream, objectMapper);
return ToDtoDecoder<DtoType>::startForResult(this, headers, bodyStream, objectMapper);
}
};

View File

@ -113,7 +113,7 @@ oatpp::String Request::readBodyToString() const {
return m_bodyDecoder->decodeToString(m_headers, m_bodyStream);
}
oatpp::async::Pipeline Request::streamBodyAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const {
oatpp::async::CoroutineStarter Request::streamBodyAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const {
return m_bodyDecoder->decodeAsync(m_headers, m_bodyStream, toStream);
}

View File

@ -190,15 +190,15 @@ public:
/**
* Transfer body stream to toStream Async
* @param toStream
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
oatpp::async::Pipeline streamBodyAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const;
oatpp::async::CoroutineStarter streamBodyAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const;
/**
* Transfer body stream to string Async.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const oatpp::String&> readBodyToStringAsync() const {
oatpp::async::CoroutineStarterForResult<const oatpp::String&> readBodyToStringAsync() const {
return m_bodyDecoder->decodeToStringAsync(m_headers, m_bodyStream);
}
@ -206,10 +206,10 @@ public:
* Transfer body to String and parse it as DTO
* @tparam DtoType - DTO object type.
* @param objectMapper
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
template<class DtoType>
oatpp::async::CoroutineCallForResult<const typename DtoType::ObjectWrapper&>
oatpp::async::CoroutineStarterForResult<const typename DtoType::ObjectWrapper&>
readBodyToDtoAsync(const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& objectMapper) const {
return m_bodyDecoder->decodeToDtoAsync<DtoType>(m_headers, m_bodyStream, objectMapper);
}

View File

@ -95,7 +95,7 @@ RequestHeadersReader::Result RequestHeadersReader::readHeaders(const std::shared
}
oatpp::async::CoroutineCallForResult<const RequestHeadersReader::Result&>
oatpp::async::CoroutineStarterForResult<const RequestHeadersReader::Result&>
RequestHeadersReader::readHeadersAsync(const std::shared_ptr<oatpp::data::stream::IOStream>& connection)
{
@ -181,7 +181,7 @@ RequestHeadersReader::readHeadersAsync(const std::shared_ptr<oatpp::data::stream
};
return ReaderCoroutine::callForResult(connection, m_buffer, m_bufferSize, m_maxHeadersSize);
return ReaderCoroutine::startForResult(connection, m_buffer, m_bufferSize, m_maxHeadersSize);
}

View File

@ -101,9 +101,9 @@ public:
/**
* Read and parse http headers from stream in asynchronous manner.
* @param connection - `std::shared_ptr` to &id:oatpp::data::stream::IOStream;.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const RequestHeadersReader::Result&> readHeadersAsync(const std::shared_ptr<oatpp::data::stream::IOStream>& connection);
oatpp::async::CoroutineStarterForResult<const RequestHeadersReader::Result&> readHeadersAsync(const std::shared_ptr<oatpp::data::stream::IOStream>& connection);
};

View File

@ -74,7 +74,7 @@ oatpp::String Response::readBodyToString() const {
return m_bodyDecoder->decodeToString(m_headers, m_bodyStream);
}
oatpp::async::Pipeline Response::streamBodyAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const {
oatpp::async::CoroutineStarter Response::streamBodyAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const {
return m_bodyDecoder->decodeAsync(m_headers, m_bodyStream, toStream);
}

View File

@ -142,15 +142,15 @@ public:
/**
* Same as &l:Response::readBodyToDto (); but Async.
* @param toStream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
oatpp::async::Pipeline streamBodyAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const;
oatpp::async::CoroutineStarter streamBodyAsync(const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const;
/**
* Same as &l:Response::readBodyToString (); but Async.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const oatpp::String&> readBodyToStringAsync() const {
oatpp::async::CoroutineStarterForResult<const oatpp::String&> readBodyToStringAsync() const {
return m_bodyDecoder->decodeToStringAsync(m_headers, m_bodyStream);
}
@ -158,10 +158,10 @@ public:
* Same as &l:Response::readBodyToDto (); but Async.
* @tparam DtoType - DTO object type.
* @param objectMapper - `std::shared_ptr` to &id:oatpp::data::mapping::ObjectMapper;.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
template<class DtoType>
oatpp::async::CoroutineCallForResult<const typename DtoType::ObjectWrapper&>
oatpp::async::CoroutineStarterForResult<const typename DtoType::ObjectWrapper&>
readBodyToDtoAsync(const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& objectMapper) const {
return m_bodyDecoder->decodeToDtoAsync<DtoType>(m_headers, m_bodyStream, objectMapper);
}

View File

@ -94,7 +94,7 @@ ResponseHeadersReader::Result ResponseHeadersReader::readHeaders(const std::shar
}
oatpp::async::CoroutineCallForResult<const ResponseHeadersReader::Result&>
oatpp::async::CoroutineStarterForResult<const ResponseHeadersReader::Result&>
ResponseHeadersReader::readHeadersAsync(const std::shared_ptr<oatpp::data::stream::IOStream>& connection)
{
@ -180,7 +180,7 @@ ResponseHeadersReader::readHeadersAsync(const std::shared_ptr<oatpp::data::strea
};
return ReaderCoroutine::callForResult(connection, m_buffer, m_bufferSize, m_maxHeadersSize);
return ReaderCoroutine::startForResult(connection, m_buffer, m_bufferSize, m_maxHeadersSize);
}

View File

@ -101,9 +101,9 @@ public:
/**
* Read and parse http headers from stream in asynchronous manner.
* @param connection - `std::shared_ptr` to &id:oatpp::data::stream::IOStream;.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const Result&> readHeadersAsync(const std::shared_ptr<oatpp::data::stream::IOStream>& connection);
oatpp::async::CoroutineStarterForResult<const Result&> readHeadersAsync(const std::shared_ptr<oatpp::data::stream::IOStream>& connection);
};

View File

@ -110,7 +110,7 @@ void SimpleBodyDecoder::decode(const Headers& headers,
}
oatpp::async::Pipeline SimpleBodyDecoder::doChunkedDecodingAsync(const std::shared_ptr<oatpp::data::stream::InputStream>& fromStream,
oatpp::async::CoroutineStarter SimpleBodyDecoder::doChunkedDecodingAsync(const std::shared_ptr<oatpp::data::stream::InputStream>& fromStream,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) {
class ChunkedDecoder : public oatpp::async::Coroutine<ChunkedDecoder> {
@ -205,13 +205,13 @@ oatpp::async::Pipeline SimpleBodyDecoder::doChunkedDecodingAsync(const std::shar
};
return oatpp::async::AbstractCoroutine::startCoroutine<ChunkedDecoder>(fromStream, toStream);
return ChunkedDecoder::start(fromStream, toStream);
}
oatpp::async::Pipeline SimpleBodyDecoder::decodeAsync(const Headers& headers,
const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const {
oatpp::async::CoroutineStarter SimpleBodyDecoder::decodeAsync(const Headers& headers,
const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const {
auto transferEncodingIt = headers.find(Header::TRANSFER_ENCODING);
if(transferEncodingIt != headers.end() && transferEncodingIt->second == Header::Value::TRANSFER_ENCODING_CHUNKED) {
return doChunkedDecodingAsync(bodyStream, toStream);

View File

@ -40,7 +40,7 @@ private:
static void doChunkedDecoding(const std::shared_ptr<oatpp::data::stream::InputStream>& from,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream);
static oatpp::async::Pipeline doChunkedDecodingAsync(const std::shared_ptr<oatpp::data::stream::InputStream>& fromStream,
static oatpp::async::CoroutineStarter doChunkedDecodingAsync(const std::shared_ptr<oatpp::data::stream::InputStream>& fromStream,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream);
public:
@ -59,11 +59,11 @@ public:
* @param headers - Headers map. &id:oatpp::web::protocol::http::Headers;.
* @param bodyStream - `std::shared_ptr` to &id:oatpp::data::stream::InputStream;.
* @param toStream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
oatpp::async::Pipeline decodeAsync(const Headers& headers,
const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const override;
oatpp::async::CoroutineStarter decodeAsync(const Headers& headers,
const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const override;
};

View File

@ -67,9 +67,9 @@ public:
/**
* Same as &l:Body::writeToStream (); but async.
* @param stream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
virtual oatpp::async::Pipeline writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) = 0;
virtual oatpp::async::CoroutineStarter writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) = 0;
};

View File

@ -55,8 +55,8 @@ void BufferBody::writeToStream(const std::shared_ptr<OutputStream>& stream) noex
}
oatpp::async::Pipeline BufferBody::writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) {
return oatpp::async::AbstractCoroutine::startCoroutine<WriteToStreamCoroutine>(shared_from_this(), stream);
oatpp::async::CoroutineStarter BufferBody::writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) {
return WriteToStreamCoroutine::start(shared_from_this(), stream);
}
}}}}}

View File

@ -94,9 +94,9 @@ public:
/**
* Start &l:BufferBody::WriteToStreamCoroutine; to write buffer data to stream.
* @param stream - &id:oatpp::data::stream::OutputStream;.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
oatpp::async::Pipeline writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) override;
oatpp::async::CoroutineStarter writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) override;
};

View File

@ -113,9 +113,9 @@ async::Action ChunkedBufferBody::WriteToStreamCoroutine::writeCurrData() {
return oatpp::data::stream::writeExactSizeDataAsyncInline(this, m_stream.get(), m_currData, m_currDataSize, Action::clone(m_nextAction));
}
oatpp::async::Pipeline ChunkedBufferBody::writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) {
oatpp::async::CoroutineStarter ChunkedBufferBody::writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) {
if(m_chunked) {
return oatpp::async::AbstractCoroutine::startCoroutine<WriteToStreamCoroutine>(shared_from_this(), stream);
return WriteToStreamCoroutine::start(shared_from_this(), stream);
} else {
return m_buffer->flushToStreamAsync(stream);
}

View File

@ -112,9 +112,9 @@ public:
/**
* Start &l:ChunkedBufferBody::WriteToStreamCoroutine; to write buffer data to stream.
* @param stream - &id:oatpp::data::stream::OutputStream;.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
oatpp::async::Pipeline writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) override;
oatpp::async::CoroutineStarter writeToStreamAsync(const std::shared_ptr<OutputStream>& stream) override;
};

View File

@ -104,7 +104,7 @@ void Request::send(const std::shared_ptr<data::stream::OutputStream>& stream){
}
oatpp::async::Pipeline Request::sendAsync(const std::shared_ptr<data::stream::OutputStream>& stream){
oatpp::async::CoroutineStarter Request::sendAsync(const std::shared_ptr<data::stream::OutputStream>& stream){
class SendAsyncCoroutine : public oatpp::async::Coroutine<SendAsyncCoroutine> {
private:
@ -163,7 +163,7 @@ oatpp::async::Pipeline Request::sendAsync(const std::shared_ptr<data::stream::Ou
};
return oatpp::async::AbstractCoroutine::startCoroutine<SendAsyncCoroutine>(shared_from_this(), stream);
return SendAsyncCoroutine::start(shared_from_this(), stream);
}

View File

@ -125,9 +125,9 @@ public:
/**
* Write request to stream in asynchronous manner.
* @param stream - &id:oatpp::data::stream::OutputStream;.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
oatpp::async::Pipeline sendAsync(const std::shared_ptr<data::stream::OutputStream>& stream);
oatpp::async::CoroutineStarter sendAsync(const std::shared_ptr<data::stream::OutputStream>& stream);
};

View File

@ -98,7 +98,7 @@ void Response::send(const std::shared_ptr<data::stream::OutputStream>& stream) {
}
oatpp::async::Pipeline Response::sendAsync(const std::shared_ptr<data::stream::OutputStream>& stream){
oatpp::async::CoroutineStarter Response::sendAsync(const std::shared_ptr<data::stream::OutputStream>& stream){
class SendAsyncCoroutine : public oatpp::async::Coroutine<SendAsyncCoroutine> {
private:
@ -156,7 +156,7 @@ oatpp::async::Pipeline Response::sendAsync(const std::shared_ptr<data::stream::O
};
return oatpp::async::AbstractCoroutine::startCoroutine<SendAsyncCoroutine>(shared_from_this(), stream);
return SendAsyncCoroutine::start(shared_from_this(), stream);
}

View File

@ -117,9 +117,9 @@ public:
/**
* Same as &l:Response::send (); but async.
* @param stream - `std::shared_ptr` to &id:oatpp::data::stream::OutputStream;.
* @return - &id:oatpp::async::Pipeline;.
* @return - &id:oatpp::async::CoroutineStarter;.
*/
oatpp::async::Pipeline sendAsync(const std::shared_ptr<data::stream::OutputStream>& stream);
oatpp::async::CoroutineStarter sendAsync(const std::shared_ptr<data::stream::OutputStream>& stream);
};

View File

@ -171,7 +171,7 @@ protected:
class Handler : public oatpp::web::url::mapping::Subscriber<std::shared_ptr<IncomingRequest>, std::shared_ptr<OutgoingResponse>> {
public:
typedef std::shared_ptr<OutgoingResponse> (T::*Method)(const std::shared_ptr<protocol::http::incoming::Request>&);
typedef oatpp::async::CoroutineCallForResult<const std::shared_ptr<OutgoingResponse>&>
typedef oatpp::async::CoroutineStarterForResult<const std::shared_ptr<OutgoingResponse>&>
(T::*MethodAsync)(const std::shared_ptr<protocol::http::incoming::Request>&);
private:
T* m_controller;
@ -197,7 +197,7 @@ protected:
}
}
oatpp::async::CoroutineCallForResult<const std::shared_ptr<OutgoingResponse>&>
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<OutgoingResponse>&>
processEventAsync(const std::shared_ptr<protocol::http::incoming::Request>& request) override {
if(m_methodAsync != nullptr) {
return (m_controller->*m_methodAsync)(request);

View File

@ -95,9 +95,9 @@ public:
/**
* Call &id:oatpp::web::url::mapping::Subscriber::processEventAsync; with corresponding parameter.
* @param param
* @return - &id:oatpp::async::CaroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
oatpp::async::CoroutineCallForResult<const ReturnType&> processEventAsync(const Param& param) const {
oatpp::async::CoroutineStarterForResult<const ReturnType&> processEventAsync(const Param& param) const {
return m_subscriber->processEventAsync(param);
}

View File

@ -48,9 +48,9 @@ public:
/**
* Process event in asynchronous manner.
* @param event - some incoming data.
* @return - &id:oatpp::async::CoroutineCallForResult;.
* @return - &id:oatpp::async::CoroutineStarterForResult;.
*/
virtual oatpp::async::CoroutineCallForResult<const Result&> processEventAsync(const Event& event) = 0;
virtual oatpp::async::CoroutineStarterForResult<const Result&> processEventAsync(const Event& event) = 0;
};
}}}}