Qore DataStreamClient Module Reference  1.0
DataStreamClient.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
2 // @file DataStreamClient.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 /* DataStreamClient.qm Copyright (C) 2014 - 2015 Qore Technologies, sro
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 // this module requires Qore 0.8.10 or better
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 namespace DataStreamClient {
70 
71 public:
72 private:
73 
74 public:
75 
77 
79  any sendData();
80 
81 
83 
85  private abstract any sendDataImpl();
86  };
87 
90 
91 public:
92  public :
93  // any datastream error received from the remote end
94  string err;
95 
96 public:
97 
99 
101  nothing recvData(any data);
102 
103 
105 
107  nothing recvDataDone(*string err);
108 
109 
111 
113  private nothing recvDataDoneImpl(*string err);
114 
115 
117 
119  private abstract nothing recvDataImpl(any data);
120  };
121 
124 
125 public:
126  };
127 
129 class DataStreamClient : public RestClient::RestClient {
130 
131 public:
132  public :
134  const Version = "1.0";
135 
137  const VersionString = sprintf("Qore-DataStreamClient/%s", DataStreamClient::Version);
138 
140  const DefaultHeaders = RestClient::DefaultHeaders + (
141  "User-Agent": DataStreamClient::VersionString,
142  DataStreamAccept: MimeTypeYaml,
143  );
144 
145 public:
146 
148 
169  constructor(*hash opts, *softbool do_not_connect);
170 
171 
173 
202  recvDataStream(code rcb, code ecb, string method, string path, any body, timeout timeout_ms = 0, *reference info, *hash hdr);
203 
204 
206 
234  recvDataStream(DataStreamRecvMessage dsm, string method, string path, any body, timeout timeout_ms = 0, *reference info, *hash hdr);
235 
236 
238 
272  hash sendDataStream(code scb, string method, string path, timeout timeout_ms = 0, *reference info, *hash hdr);
273 
274 
276 
310  hash sendDataStream(DataStreamSendMessage dsm, string method, string path, timeout timeout_ms = 0, *reference info, *hash hdr);
311 
312 
314 
350  sendRecvDataStream(code scb, code rcb, code ecb, string method, string path, timeout timeout_ms = 0, *reference info, *hash hdr);
351 
352 
354 
388  sendRecvDataStream(DataStreamMessage dsm, string method, string path, timeout timeout_ms = 0, *reference info, *hash hdr);
389 
390 
392 
420  hash sendRawStream(code scb, string method, *string path, timeout timeout_ms = 0, *reference info, *hash hdr);
421 
422 
424 
459  hash getRawStream(code rcb, string method, *string path, any body, timeout timeout_ms = 0, *reference info, *hash hdr);
460 
461 
463 
475  addDefaultHeaders(hash h);
476 
477 
479 
488  setContentEncoding(string enc = "auto");
489 
490 
492  private nothing prepareMsg(reference body, reference hdr, string ct = "Content-Type");
493 
494 
496  hash sendAndDecodeResponse(*data body, string m, string path, hash hdr, *reference info, *softbool decode_errors);
497 
498  };
499 };
abstract private any sendDataImpl()
reimplement this method in subclasses to support streamed data transfers; when this method returns no...
this class can be used to send and receive data using the DataStream protocol
Definition: DataStreamClient.qm.dox.h:69
private nothing recvDataDoneImpl(*string err)
this method is called when all data has been received
nothing recvDataDone(*string err)
this method is called when all data has been received; this method calls recvDataDoneImpl() ...
the DataStreamClient namespace contains all the public objects in the DataStreamClient module ...
Definition: DataStreamClient.qm.dox.h:67
this class can be used to send and receive data using the DataStream protocol
Definition: DataStreamClient.qm.dox.h:89
nothing recvData(any data)
receives decoded data from the remote end and calls recvDataImpl()
abstract private nothing recvDataImpl(any data)
reimplement this method in subclasses to receive decoded and deserialized data
any sendData()
this method returns data to be returned to the server; when this method returns no value...
this class can be used to send and receive data using the DataStream protocol
Definition: DataStreamClient.qm.dox.h:123
const DataStreamAccept