Qore DataStreamRequestHandler Module Reference 1.0
DataStreamRequestHandler.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
2// @file DataStreamRequestHandler.qm Qore user module implementing client support for the DataStream protocol: YAML-encoded HTTP chunked transfers where each chunk is a unique data entity
3
4/* DataStreamRequestHandler.qm Copyright (C) 2014 - 2019 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25// minimum Qore version
26
27// require type definitions everywhere
28
29// enable all warnings
30
31
32// do not use $ signs in declarations
33
34
35/* Version History: see docs below
36*/
37
66
69class AbstractDataStreamRequestHandler : public RestHandler::AbstractRestStreamRequestHandler {
70
71public:
73 code rcb;
74
76 code scb;
77
79 bool recv_done = False;
80
82 bool send_done = False;
83
85 int err;
86
88 *string send_error;
89
91 constructor(hash<auto> cx, *hash<auto> ah) ;
92
93
95
97 *hash<auto> getErrorResponse();
98
99
101
111
112
114 nothing recvImpl(hash v);
115
116
118 auto sendImpl();
119
120
122protected:
123 nothing recvDataDone(*string err);
124public:
125
126
128
130protected:
131 nothing recvData(auto data);
132public:
133
134
136
138protected:
139 auto sendData();
140public:
141
142
144protected:
145 nothing recvDataDoneImpl(*string err);
146public:
147
148
150
152protected:
153 abstract nothing recvDataImpl(auto data);
154public:
155
157
159protected:
160 abstract auto sendDataImpl();
161public:
162 };
163};
this class implements a chunked request handler supporting the DataStream protocol
Definition: DataStreamRequestHandler.qm.dox.h:69
abstract nothing recvDataImpl(auto data)
reimplement this method in subclasses to receive decoded and deserialized data
int err
HTTP status code for error response sent.
Definition: DataStreamRequestHandler.qm.dox.h:85
bool send_done
flag for when all data has been sent
Definition: DataStreamRequestHandler.qm.dox.h:82
auto sendData()
This is the concrete method called when data is received; it calls recvDataImpl() in turn.
code rcb
the receive callback as returned by the DataStreamUtil module
Definition: DataStreamRequestHandler.qm.dox.h:73
nothing recvImpl(hash v)
calls the receive callback as returned by the DataStreamUtil module, which in turn calls recvDataImpl...
code scb
the send callback as returned by the DataStreamUtil module
Definition: DataStreamRequestHandler.qm.dox.h:76
bool recv_done
flag for when all data has been received
Definition: DataStreamRequestHandler.qm.dox.h:79
abstract auto sendDataImpl()
reimplement this method in subclasses to support streamed data transfers; when this method returns no...
nothing recvDataDone(*string err)
this method is called when all data has been received
*hash< auto > getErrorResponse()
if an error occurred, then return a hash giving an error response, otherwise return nothing
*string send_error
send error string received
Definition: DataStreamRequestHandler.qm.dox.h:88
constructor(hash< auto > cx, *hash< auto > ah)
creates the chunked request handler according to the arguments
nothing recvDataDoneImpl(*string err)
this method is called when all data has been received
hash< auto > getResponseHeaderMessageImpl()
returns the response header to the request
auto sendImpl()
calls the send callback as returned by the DataStreamUtil module, which in turn calls sendDataImpl() ...
nothing recvData(auto data)
This is the concrete method called when data is received; it calls recvDataImpl() in turn.
the DataStreamRequestHandler namespace contains all the public objects in the DataStreamRequestHandle...
Definition: DataStreamRequestHandler.qm.dox.h:64