#include <thriftTransport.hpp>
Public Member Functions | |
| ThriftTransport (anch::rest::Client &client, std::string path, anch::codec::ThriftProtocol protocol=anch::codec::ThriftProtocol::BINARY) | |
| virtual bool | isOpen () const override |
| virtual void | open () override |
| virtual void | close () override |
| uint32_t | read (uint8_t *buffer, uint32_t length) |
| void | write (const uint8_t *buffer, uint32_t length) |
| virtual void | flush () override |
Thrift transport over an anch-rest client (header only: link anch::rest-client ): calls are sent with POST path on client base URL (client filters, authentication and transport apply), to an API with installThrift or any Thrift HTTP server. Clients generated by thrift –gen cpp use it as is:
The protocol given to the transport sets the request content type (it has to be the one of the client protocol). Responses with status greater or equal to 400 raise HttpError . A transport is used by one client at a time.
| anch::rest::ThriftTransport::ThriftTransport | ( | anch::rest::Client & | client, |
| std::string | path, | ||
| anch::codec::ThriftProtocol | protocol = anch::codec::ThriftProtocol::BINARY ) |
ThriftTransport constructor
| client | the anch-rest client (it has to outlive the transport) |
| path | the service path |
| protocol | the protocol of the Thrift client (request content type) |
|
overridevirtual |
Nothing to close
|
overridevirtual |
Send request and receive response
| HttpError | when response status is greater or equal to 400 |
| TransportError | on network error |
|
overridevirtual |
Transport is always open (connections are managed by the anch-rest transport)
true
|
overridevirtual |
Nothing to open
| uint32_t anch::rest::ThriftTransport::read | ( | uint8_t * | buffer, |
| uint32_t | length ) |
Read response
| buffer | the buffer to fill |
| length | the maximum length |
0 at the end of the response | void anch::rest::ThriftTransport::write | ( | const uint8_t * | buffer, |
| uint32_t | length ) |
Write request
| buffer | the data |
| length | the data length |