|
| 1 | +# Tntcxx Client Design |
| 2 | + |
| 3 | +## Scope |
| 4 | + |
| 5 | +This document describes the design of the Client part of Tntcxx. First we |
| 6 | +state the requirements and use cases we have in mind, and then we propose a |
| 7 | +design that fulfills them. |
| 8 | + |
| 9 | +## Requirements |
| 10 | + |
| 11 | +### Functional Requirements |
| 12 | + |
| 13 | +We envision Tntcxx to be used primarily as a part of network applications (e.g., |
| 14 | +an HTTP server), the Client backing requests to Tarantool. Such applications are |
| 15 | +usually built around a central event processing loop, which is responsible for |
| 16 | +multiplexing network I/O. |
| 17 | + |
| 18 | +#### Application Event Processing Loop Integration |
| 19 | + |
| 20 | +The first and foremost requirement is that there must be a convenient |
| 21 | +way to integrate the Tntcxx Client into the event processing loop used by the |
| 22 | +application. Moreover, the Client must never run the event processing |
| 23 | +loop itself. |
| 24 | + |
| 25 | +At the same time, since event processing loops are inherently single threaded, |
| 26 | +we do expect the Tntcxx Client to be used in a multithreaded environment, i.e., |
| 27 | +when connections and reqeust futures are in different threads. So we do not aim |
| 28 | +to design the Client to be thread-safe. |
| 29 | + |
| 30 | +#### Asynchronous Request Processing |
| 31 | + |
| 32 | +Since the Tntcxx Client is constrained from running the event processing loop, |
| 33 | +the Client must support asynchronous request processing through |
| 34 | +application-provided callbacks. The Client must only be responsible for |
| 35 | +posting requests — the responses must be processed and returned to the |
| 36 | +application as they arrive, i.e., asynchronously. |
| 37 | + |
| 38 | +#### Connection Status |
| 39 | + |
| 40 | +The application must be able to query the status of a Tntcxx Client. |
| 41 | + |
| 42 | +#### Request Readiness |
| 43 | + |
| 44 | +The application must be able to query the readiness of a request issued |
| 45 | +through the Tntcxx Client. |
| 46 | + |
| 47 | +#### Request Cancelling |
| 48 | + |
| 49 | +The application must be able to cancel a request issued through the Tntcxx |
| 50 | +Client. |
| 51 | + |
| 52 | +#### Error Handling |
| 53 | + |
| 54 | +There must be a convenient exception-safe way for the application to handle |
| 55 | +errors arising throughout the Tntcxx Client request lifecycle. |
| 56 | + |
| 57 | +#### Should the Request Handle give access to the response? |
| 58 | + |
| 59 | +#### NetworkProvider: Proactor vs Reactor? |
| 60 | + |
| 61 | +#### Request Retrying? |
| 62 | + |
| 63 | +#### Transactions? |
| 64 | + |
| 65 | +#### Connection Pool? |
| 66 | + |
| 67 | +#### Failover? |
| 68 | + |
| 69 | +### Non-Functional Requirements |
| 70 | + |
| 71 | +#### System Call Minimization |
| 72 | + |
| 73 | +#### Scalability |
| 74 | + |
0 commit comments