Closed rustatian closed 2 years ago
Merging #95 (d0882de) into master (e88aac4) will decrease coverage by
0.08%
. The diff coverage is67.97%
.
@@ Coverage Diff @@
## master #95 +/- ##
==========================================
- Coverage 67.80% 67.72% -0.09%
==========================================
Files 123 129 +6
Lines 10093 10437 +344
==========================================
+ Hits 6844 7068 +224
- Misses 2569 2673 +104
- Partials 680 696 +16
Impacted Files | Coverage Δ | |
---|---|---|
grpc/proxy/proxy.go | 60.95% <0.00%> (-1.72%) |
:arrow_down: |
reload/plugin.go | 73.78% <0.00%> (ø) |
|
server/plugin.go | 64.02% <0.00%> (-0.80%) |
:arrow_down: |
tcp/handler/handler.go | 57.43% <57.43%> (ø) |
|
tcp/handler/helpers.go | 57.89% <57.89%> (ø) |
|
tcp/config.go | 62.50% <62.50%> (ø) |
|
tcp/plugin.go | 71.30% <71.30%> (ø) |
|
grpc/parser/parse.go | 100.00% <100.00%> (ø) |
|
http/handler/handler.go | 84.95% <100.00%> (+0.06%) |
:arrow_up: |
http/middleware/static/plugin.go | 71.02% <100.00%> (+1.12%) |
:arrow_up: |
... and 8 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update e88aac4...d0882de. Read the comment docs.
Reason for This PR
Description of Changes
Client library
Configuration
Where:
servers
: is the list of TCP servers to start. Every server should contain:addr
: server address with port.delimiter
: data packets delimiter. Every send should end either with EOF or with the delimiter.read_buf_size
: chunks that RR uses to read the data. In MB. If you expect big payloads on a TCP server, to reduceread
syscalls, would be a good practice to use a fairly big enough buffer.RR Protocol
Protocol used to have bi-directional communication channel between the PHP worker and the RR server. The protocol can be used by any third-party library and has its own client API with the RR. Our reference implementation is: https://github.com/spiral/roadrunner-tcp.
OnConnect
: when the connection is established, RR sends payload with theCONNECTED
header to the worker with connection uuid, server name, and connection remote address. The PHP worker might then respond with the following headers:WRITE
- to write the data in the connection and then start the read loop. After data arrived in the connection, RR will read it and send to it the PHP worker with the headerDATA
.CONTINUE
- to start the read loop without writing the data into the connection. RR will send read data to the PHP worker with theDATA
header.WRITECLOSE
- to write the data, close the connection and free up the allocated resources. RR will send theCLOSED
header to the worker after the actual data will be written and the connection is closed.CLOSE
- to just close the connection and free up the allocated resources. RR will send theCLOSED
header to the PHP worker.OnConnectionClosed
: when the connection is closed for any reason, RR sends theCLOSED
header to the worker with the connection UUID, server name and connection remote address.OnDataArrived
: when the data arrived, RR read the data expecting delimiter at the end of the read and sends the data to the PHP worker with theDATA
header.To summarize:
PHP worker sends the following headers:
WRITE
CONTINUE
WRITECLOSE
CLOSE
RR sends:
CONNECTED
DATA
CLOSED
Worker sample
License Acceptance
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
PR Checklist
[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]
git commit -s
).CHANGELOG.md
.