wirestead 0.9.3__tar.gz → 0.9.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wirestead-0.9.3 → wirestead-0.9.4}/CHANGELOG.md +22 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/PKG-INFO +1 -1
- wirestead-0.9.4/VCPKG_BASELINE +1 -0
- wirestead-0.9.4/WIRESTEAD_CORE_REF +1 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/bindings/python/module.cpp.in +110 -0
- wirestead-0.9.4/docs/api.md +56 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/docs/compatibility.md +1 -0
- wirestead-0.9.4/src/wirestead/_version.py +1 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/tests/test_api_surface.py +74 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/tests/test_tcp_loopback.py +44 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/vcpkg.json +1 -1
- wirestead-0.9.3/VCPKG_BASELINE +0 -1
- wirestead-0.9.3/WIRESTEAD_CORE_REF +0 -1
- wirestead-0.9.3/docs/api.md +0 -13
- wirestead-0.9.3/src/wirestead/_version.py +0 -1
- {wirestead-0.9.3 → wirestead-0.9.4}/.clang-format +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/.cmake-format.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/.github/dependabot.yml +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/.github/pull_request_template.md +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/.github/workflows/ci.yml +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/.github/workflows/code-formatting.yml +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/.github/workflows/release.yml +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/.github/workflows/vcpkg-baseline-sync.yml +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/.gitignore +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/CMakeLists.txt +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/CONTRIBUTING.md +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/LICENSE +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/NOTICE +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/README.md +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/bindings/python/diagnose_windows_import.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/cmake/FindOrBuildWiresteadCore.cmake +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/docs/installation.md +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/docs/packaging.md +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/docs/packet-probe-viewer-ipc.md +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/docs/release.md +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/pyproject.toml +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/scripts/consumer_smoke.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/scripts/run_wheel_consumer_smoke.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/scripts/verify.sh +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/src/wirestead/__init__.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/src/wirestead/asyncio.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/src/wirestead/py.typed +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/tests/conftest.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/tests/test_asyncio_uds.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/tests/test_import.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/tests/test_project_metadata.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/tests/test_udp_loopback.py +0 -0
- {wirestead-0.9.3 → wirestead-0.9.4}/tests/test_uds_loopback.py +0 -0
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Wirestead Python are documented in this file.
|
|
4
4
|
|
|
5
|
+
## v0.9.4
|
|
6
|
+
|
|
7
|
+
Released against Wirestead C++ core v0.9.4.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `stats()` and `reset_stats()` on every transport, returning a `RuntimeStats`
|
|
12
|
+
snapshot with the full set of counters: bytes and messages accepted, sent and
|
|
13
|
+
received; failed sends; dropped bytes and messages; backpressure events;
|
|
14
|
+
queued, pending and peak queue bytes; and whether backpressure is currently
|
|
15
|
+
active.
|
|
16
|
+
|
|
17
|
+
The C++ core has carried these since before the Python package existed, but
|
|
18
|
+
none of it was bound, so Python callers could configure
|
|
19
|
+
`backpressure_strategy` and subscribe to `on_backpressure` while having no way
|
|
20
|
+
to read the result. That gap was worst under `BackpressureStrategy.BestEffort`,
|
|
21
|
+
where the callback is not a reliable loss signal: dropping is what holds the
|
|
22
|
+
queue below the threshold that would fire it, so a server discarding hundreds
|
|
23
|
+
of megabytes can report `backpressure_events == 0` throughout. Discarded data
|
|
24
|
+
had no observable signal at all from Python. `dropped_bytes` and
|
|
25
|
+
`dropped_messages` now provide one.
|
|
26
|
+
|
|
5
27
|
## v0.9.3
|
|
6
28
|
|
|
7
29
|
Release aligned with Wirestead C++ core 0.9.3.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
39344dff01c5a5a0134caf2624cdd492f05d30ea
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v0.9.4
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#include <future>
|
|
10
10
|
#include <memory>
|
|
11
11
|
#include <stop_token>
|
|
12
|
+
#include <string>
|
|
12
13
|
#include <thread>
|
|
13
14
|
|
|
14
15
|
#include "wirestead/framer/line_framer.hpp"
|
|
@@ -138,6 +139,45 @@ PYBIND11_MODULE(_core, m) {
|
|
|
138
139
|
.def_property_readonly("message", [](const ErrorContext& self) { return std::string(self.message()); })
|
|
139
140
|
.def_property_readonly("client_id", &ErrorContext::client_id);
|
|
140
141
|
|
|
142
|
+
// RuntimeStats - an immutable snapshot returned by stats(), not a live view.
|
|
143
|
+
//
|
|
144
|
+
// The three families count different layers: *_accepted is what the
|
|
145
|
+
// application handed to the library, *_sent is what the socket wrote, and
|
|
146
|
+
// *_received counts read completions rather than framed messages. Byte totals
|
|
147
|
+
// reconcile between accepted and sent; message counts do not, because queued
|
|
148
|
+
// writes are batched.
|
|
149
|
+
//
|
|
150
|
+
// Under BackpressureStrategy.BestEffort the on_backpressure callback is not a
|
|
151
|
+
// reliable loss signal. Dropping is what holds the queue below the threshold
|
|
152
|
+
// that would fire it, so whether the callback fires at all depends on how the
|
|
153
|
+
// queue happens to cross that threshold - a server dropping hundreds of
|
|
154
|
+
// megabytes can report backpressure_events == 0 throughout. Watch
|
|
155
|
+
// dropped_bytes and dropped_messages instead.
|
|
156
|
+
py::class_<RuntimeStats>(m, "RuntimeStats")
|
|
157
|
+
.def_readonly("bytes_accepted", &RuntimeStats::bytes_accepted)
|
|
158
|
+
.def_readonly("messages_accepted", &RuntimeStats::messages_accepted)
|
|
159
|
+
.def_readonly("bytes_sent", &RuntimeStats::bytes_sent)
|
|
160
|
+
.def_readonly("messages_sent", &RuntimeStats::messages_sent)
|
|
161
|
+
.def_readonly("bytes_received", &RuntimeStats::bytes_received)
|
|
162
|
+
.def_readonly("messages_received", &RuntimeStats::messages_received)
|
|
163
|
+
.def_readonly("failed_sends", &RuntimeStats::failed_sends)
|
|
164
|
+
.def_readonly("dropped_messages", &RuntimeStats::dropped_messages)
|
|
165
|
+
.def_readonly("dropped_bytes", &RuntimeStats::dropped_bytes)
|
|
166
|
+
.def_readonly("backpressure_events", &RuntimeStats::backpressure_events)
|
|
167
|
+
.def_readonly("queued_bytes", &RuntimeStats::queued_bytes)
|
|
168
|
+
.def_readonly("pending_bytes", &RuntimeStats::pending_bytes)
|
|
169
|
+
.def_readonly("max_queued_bytes", &RuntimeStats::max_queued_bytes)
|
|
170
|
+
.def_readonly("backpressure_active", &RuntimeStats::backpressure_active)
|
|
171
|
+
.def("__repr__", [](const RuntimeStats& self) {
|
|
172
|
+
return "<RuntimeStats accepted=" + std::to_string(self.bytes_accepted) + "B/" +
|
|
173
|
+
std::to_string(self.messages_accepted) + " sent=" + std::to_string(self.bytes_sent) + "B/" +
|
|
174
|
+
std::to_string(self.messages_sent) + " received=" + std::to_string(self.bytes_received) + "B/" +
|
|
175
|
+
std::to_string(self.messages_received) + " dropped=" + std::to_string(self.dropped_bytes) + "B/" +
|
|
176
|
+
std::to_string(self.dropped_messages) + " queued=" + std::to_string(self.queued_bytes) +
|
|
177
|
+
"B peak=" + std::to_string(self.max_queued_bytes) +
|
|
178
|
+
"B backpressure=" + (self.backpressure_active ? "active" : "inactive") + ">";
|
|
179
|
+
});
|
|
180
|
+
|
|
141
181
|
// Framer
|
|
142
182
|
py::class_<framer::IFramer, std::shared_ptr<framer::IFramer>>(m, "IFramer");
|
|
143
183
|
|
|
@@ -190,6 +230,16 @@ PYBIND11_MODULE(_core, m) {
|
|
|
190
230
|
return self.send_blocking(data);
|
|
191
231
|
})
|
|
192
232
|
.def("connected", &TcpClient::connected)
|
|
233
|
+
.def("stats",
|
|
234
|
+
[](TcpClient& self) {
|
|
235
|
+
py::gil_scoped_release release;
|
|
236
|
+
return self.stats();
|
|
237
|
+
})
|
|
238
|
+
.def("reset_stats",
|
|
239
|
+
[](TcpClient& self) {
|
|
240
|
+
py::gil_scoped_release release;
|
|
241
|
+
self.reset_stats();
|
|
242
|
+
})
|
|
193
243
|
.def("auto_start", &TcpClient::auto_start, py::arg("start") = true)
|
|
194
244
|
.def("retry_interval", &TcpClient::retry_interval)
|
|
195
245
|
.def("max_retries", &TcpClient::max_retries)
|
|
@@ -330,6 +380,16 @@ PYBIND11_MODULE(_core, m) {
|
|
|
330
380
|
.def("client_count", &TcpServer::client_count)
|
|
331
381
|
.def("connected_clients", &TcpServer::connected_clients)
|
|
332
382
|
.def("listening", &TcpServer::listening)
|
|
383
|
+
.def("stats",
|
|
384
|
+
[](TcpServer& self) {
|
|
385
|
+
py::gil_scoped_release release;
|
|
386
|
+
return self.stats();
|
|
387
|
+
})
|
|
388
|
+
.def("reset_stats",
|
|
389
|
+
[](TcpServer& self) {
|
|
390
|
+
py::gil_scoped_release release;
|
|
391
|
+
self.reset_stats();
|
|
392
|
+
})
|
|
333
393
|
.def(
|
|
334
394
|
"auto_start", [](TcpServer& self, bool start) -> TcpServer& { return self.auto_start(start); },
|
|
335
395
|
py::arg("start") = true, py::return_value_policy::reference_internal)
|
|
@@ -459,6 +519,16 @@ PYBIND11_MODULE(_core, m) {
|
|
|
459
519
|
})
|
|
460
520
|
.def("send_line", &Serial::send_line)
|
|
461
521
|
.def("connected", &Serial::connected)
|
|
522
|
+
.def("stats",
|
|
523
|
+
[](Serial& self) {
|
|
524
|
+
py::gil_scoped_release release;
|
|
525
|
+
return self.stats();
|
|
526
|
+
})
|
|
527
|
+
.def("reset_stats",
|
|
528
|
+
[](Serial& self) {
|
|
529
|
+
py::gil_scoped_release release;
|
|
530
|
+
self.reset_stats();
|
|
531
|
+
})
|
|
462
532
|
.def("auto_start", &Serial::auto_start, py::arg("start") = true)
|
|
463
533
|
.def("baud_rate", &Serial::baud_rate)
|
|
464
534
|
.def("data_bits", &Serial::data_bits)
|
|
@@ -574,6 +644,16 @@ PYBIND11_MODULE(_core, m) {
|
|
|
574
644
|
})
|
|
575
645
|
.def("send_line", &UdsClient::send_line)
|
|
576
646
|
.def("connected", &UdsClient::connected)
|
|
647
|
+
.def("stats",
|
|
648
|
+
[](UdsClient& self) {
|
|
649
|
+
py::gil_scoped_release release;
|
|
650
|
+
return self.stats();
|
|
651
|
+
})
|
|
652
|
+
.def("reset_stats",
|
|
653
|
+
[](UdsClient& self) {
|
|
654
|
+
py::gil_scoped_release release;
|
|
655
|
+
self.reset_stats();
|
|
656
|
+
})
|
|
577
657
|
.def("auto_start", &UdsClient::auto_start, py::arg("start") = true)
|
|
578
658
|
.def("retry_interval", &UdsClient::retry_interval)
|
|
579
659
|
.def("max_retries", &UdsClient::max_retries)
|
|
@@ -692,6 +772,16 @@ PYBIND11_MODULE(_core, m) {
|
|
|
692
772
|
.def("client_count", &UdsServer::client_count)
|
|
693
773
|
.def("connected_clients", &UdsServer::connected_clients)
|
|
694
774
|
.def("listening", &UdsServer::listening)
|
|
775
|
+
.def("stats",
|
|
776
|
+
[](UdsServer& self) {
|
|
777
|
+
py::gil_scoped_release release;
|
|
778
|
+
return self.stats();
|
|
779
|
+
})
|
|
780
|
+
.def("reset_stats",
|
|
781
|
+
[](UdsServer& self) {
|
|
782
|
+
py::gil_scoped_release release;
|
|
783
|
+
self.reset_stats();
|
|
784
|
+
})
|
|
695
785
|
.def("auto_start", &UdsServer::auto_start, py::arg("start") = true)
|
|
696
786
|
.def("idle_timeout", &UdsServer::idle_timeout)
|
|
697
787
|
.def("max_clients", &UdsServer::max_clients)
|
|
@@ -821,6 +911,16 @@ PYBIND11_MODULE(_core, m) {
|
|
|
821
911
|
return self.send_line(line);
|
|
822
912
|
})
|
|
823
913
|
.def("connected", &UdpClient::connected)
|
|
914
|
+
.def("stats",
|
|
915
|
+
[](UdpClient& self) {
|
|
916
|
+
py::gil_scoped_release release;
|
|
917
|
+
return self.stats();
|
|
918
|
+
})
|
|
919
|
+
.def("reset_stats",
|
|
920
|
+
[](UdpClient& self) {
|
|
921
|
+
py::gil_scoped_release release;
|
|
922
|
+
self.reset_stats();
|
|
923
|
+
})
|
|
824
924
|
.def("auto_start", &UdpClient::auto_start, py::arg("start") = true)
|
|
825
925
|
.def(
|
|
826
926
|
"use_line_framer",
|
|
@@ -937,6 +1037,16 @@ PYBIND11_MODULE(_core, m) {
|
|
|
937
1037
|
.def("client_count", &UdpServer::client_count)
|
|
938
1038
|
.def("connected_clients", &UdpServer::connected_clients)
|
|
939
1039
|
.def("listening", &UdpServer::listening)
|
|
1040
|
+
.def("stats",
|
|
1041
|
+
[](UdpServer& self) {
|
|
1042
|
+
py::gil_scoped_release release;
|
|
1043
|
+
return self.stats();
|
|
1044
|
+
})
|
|
1045
|
+
.def("reset_stats",
|
|
1046
|
+
[](UdpServer& self) {
|
|
1047
|
+
py::gil_scoped_release release;
|
|
1048
|
+
self.reset_stats();
|
|
1049
|
+
})
|
|
940
1050
|
.def("auto_start", &UdpServer::auto_start, py::arg("start") = true)
|
|
941
1051
|
.def("idle_timeout", &UdpServer::idle_timeout)
|
|
942
1052
|
.def("max_clients", &UdpServer::max_clients)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# API
|
|
2
|
+
|
|
3
|
+
The Python package exposes the pybind11 API migrated from the Wirestead C++ core
|
|
4
|
+
repository.
|
|
5
|
+
|
|
6
|
+
```python
|
|
7
|
+
import wirestead
|
|
8
|
+
|
|
9
|
+
client = wirestead.TcpClient("127.0.0.1", 9000)
|
|
10
|
+
server = wirestead.TcpServer(9000)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The compiled extension is installed as `wirestead._core`.
|
|
14
|
+
|
|
15
|
+
## Runtime statistics
|
|
16
|
+
|
|
17
|
+
Every transport exposes `stats()`, which returns a `RuntimeStats` snapshot, and
|
|
18
|
+
`reset_stats()`, which zeroes the counters. The snapshot is a copy taken at the
|
|
19
|
+
moment of the call, so holding on to one and taking another later gives you a
|
|
20
|
+
delta.
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
stats = server.stats()
|
|
24
|
+
print(stats.bytes_received, stats.dropped_bytes, stats.backpressure_active)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Field | Meaning |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `bytes_accepted`, `messages_accepted` | What the application handed to the library |
|
|
30
|
+
| `bytes_sent`, `messages_sent` | What the socket actually wrote |
|
|
31
|
+
| `bytes_received`, `messages_received` | Read completions, not framed messages |
|
|
32
|
+
| `failed_sends` | Sends the library refused |
|
|
33
|
+
| `dropped_bytes`, `dropped_messages` | Discarded under `BackpressureStrategy.BestEffort` |
|
|
34
|
+
| `backpressure_events` | Congestion transitions observed |
|
|
35
|
+
| `queued_bytes`, `pending_bytes` | Currently outstanding |
|
|
36
|
+
| `max_queued_bytes` | High-water mark |
|
|
37
|
+
| `backpressure_active` | Whether congestion is on right now |
|
|
38
|
+
|
|
39
|
+
Two things are worth knowing before you read the numbers.
|
|
40
|
+
|
|
41
|
+
Byte totals reconcile between `*_accepted` and `*_sent`, but the message counts
|
|
42
|
+
do not, because queued writes are batched into fewer, larger socket writes.
|
|
43
|
+
`*_received` counts read completions for the same reason, so comparing it
|
|
44
|
+
against your own framed-message count is how you see framing at work.
|
|
45
|
+
|
|
46
|
+
Under `BackpressureStrategy.BestEffort`, `on_backpressure` is not a reliable
|
|
47
|
+
loss signal. Dropping is what holds the queue below the threshold that would
|
|
48
|
+
fire the callback, so whether it fires at all depends on how the queue happens
|
|
49
|
+
to cross that threshold: a server discarding hundreds of megabytes can report
|
|
50
|
+
`backpressure_events == 0` the whole time. Watch `dropped_bytes` and
|
|
51
|
+
`dropped_messages` instead. Under the `Reliable` default the callback does fire
|
|
52
|
+
and nothing is dropped.
|
|
53
|
+
|
|
54
|
+
A server's `stats()` aggregates its live sessions, so the counters fall back to
|
|
55
|
+
zero once every client has disconnected. Keep your own totals if you need
|
|
56
|
+
numbers that survive connection churn.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.4"
|
|
@@ -17,12 +17,86 @@ def test_core_api_surface():
|
|
|
17
17
|
"ErrorCode",
|
|
18
18
|
"LineFramer",
|
|
19
19
|
"PacketFramer",
|
|
20
|
+
"RuntimeStats",
|
|
20
21
|
]
|
|
21
22
|
|
|
22
23
|
missing = [name for name in expected if not hasattr(wirestead, name)]
|
|
23
24
|
assert not missing
|
|
24
25
|
|
|
25
26
|
|
|
27
|
+
RUNTIME_STATS_FIELDS = (
|
|
28
|
+
"bytes_accepted",
|
|
29
|
+
"messages_accepted",
|
|
30
|
+
"bytes_sent",
|
|
31
|
+
"messages_sent",
|
|
32
|
+
"bytes_received",
|
|
33
|
+
"messages_received",
|
|
34
|
+
"failed_sends",
|
|
35
|
+
"dropped_messages",
|
|
36
|
+
"dropped_bytes",
|
|
37
|
+
"backpressure_events",
|
|
38
|
+
"queued_bytes",
|
|
39
|
+
"pending_bytes",
|
|
40
|
+
"max_queued_bytes",
|
|
41
|
+
"backpressure_active",
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_every_transport_exposes_stats():
|
|
46
|
+
import wirestead
|
|
47
|
+
|
|
48
|
+
transports = (
|
|
49
|
+
wirestead.TcpClient,
|
|
50
|
+
wirestead.TcpServer,
|
|
51
|
+
wirestead.Serial,
|
|
52
|
+
wirestead.UdsClient,
|
|
53
|
+
wirestead.UdsServer,
|
|
54
|
+
wirestead.UdpClient,
|
|
55
|
+
wirestead.UdpServer,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
missing = [
|
|
59
|
+
f"{cls.__name__}.{name}"
|
|
60
|
+
for cls in transports
|
|
61
|
+
for name in ("stats", "reset_stats")
|
|
62
|
+
if not hasattr(cls, name)
|
|
63
|
+
]
|
|
64
|
+
assert not missing
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_runtime_stats_snapshot_has_every_counter():
|
|
68
|
+
import wirestead
|
|
69
|
+
|
|
70
|
+
# Constructing does not connect, so nothing has moved yet.
|
|
71
|
+
stats = wirestead.TcpClient("127.0.0.1", 65535).stats()
|
|
72
|
+
|
|
73
|
+
assert isinstance(stats, wirestead.RuntimeStats)
|
|
74
|
+
|
|
75
|
+
missing = [name for name in RUNTIME_STATS_FIELDS if not hasattr(stats, name)]
|
|
76
|
+
assert not missing
|
|
77
|
+
|
|
78
|
+
assert stats.bytes_accepted == 0
|
|
79
|
+
assert stats.bytes_sent == 0
|
|
80
|
+
assert stats.bytes_received == 0
|
|
81
|
+
assert stats.dropped_bytes == 0
|
|
82
|
+
assert stats.backpressure_events == 0
|
|
83
|
+
assert stats.backpressure_active is False
|
|
84
|
+
|
|
85
|
+
assert "RuntimeStats" in repr(stats)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_runtime_stats_fields_are_read_only():
|
|
89
|
+
import pytest
|
|
90
|
+
import wirestead
|
|
91
|
+
|
|
92
|
+
stats = wirestead.TcpClient("127.0.0.1", 65535).stats()
|
|
93
|
+
|
|
94
|
+
with pytest.raises(AttributeError):
|
|
95
|
+
stats.bytes_sent = 123
|
|
96
|
+
with pytest.raises(AttributeError):
|
|
97
|
+
stats.backpressure_active = True
|
|
98
|
+
|
|
99
|
+
|
|
26
100
|
def test_standard_python_surface_uses_canonical_names():
|
|
27
101
|
import wirestead
|
|
28
102
|
|
|
@@ -52,6 +52,50 @@ def test_tcp_server_loopback_smoke():
|
|
|
52
52
|
server.stop()
|
|
53
53
|
|
|
54
54
|
|
|
55
|
+
@pytest.mark.integration
|
|
56
|
+
def test_tcp_server_runtime_stats_track_traffic():
|
|
57
|
+
if not RUN_LOOPBACK_TESTS:
|
|
58
|
+
pytest.skip(
|
|
59
|
+
"set WIRESTEAD_PYTHON_RUN_LOOPBACK_TESTS=1 to enable real transport loopback tests"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
import wirestead
|
|
63
|
+
|
|
64
|
+
port = reserve_tcp_port()
|
|
65
|
+
server = wirestead.TcpServer(port)
|
|
66
|
+
payload = b"stats-probe\n"
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
server.bind_address("127.0.0.1")
|
|
70
|
+
assert server.start() is True
|
|
71
|
+
assert wait_until(server.listening)
|
|
72
|
+
|
|
73
|
+
with socket.create_connection(("127.0.0.1", port), timeout=3.0) as peer:
|
|
74
|
+
peer.settimeout(3.0)
|
|
75
|
+
assert wait_until(lambda: server.client_count() == 1)
|
|
76
|
+
|
|
77
|
+
assert server.stats().bytes_accepted == 0
|
|
78
|
+
|
|
79
|
+
assert server.broadcast(payload)
|
|
80
|
+
assert peer.recv(1024) == payload
|
|
81
|
+
peer.sendall(payload)
|
|
82
|
+
assert wait_until(lambda: server.stats().bytes_received >= len(payload))
|
|
83
|
+
|
|
84
|
+
stats = server.stats()
|
|
85
|
+
assert stats.bytes_accepted >= len(payload)
|
|
86
|
+
assert stats.messages_accepted >= 1
|
|
87
|
+
assert stats.bytes_received >= len(payload)
|
|
88
|
+
assert stats.dropped_bytes == 0
|
|
89
|
+
assert stats.failed_sends == 0
|
|
90
|
+
|
|
91
|
+
# The counters are a snapshot, so an earlier one keeps its values.
|
|
92
|
+
server.reset_stats()
|
|
93
|
+
assert server.stats().bytes_accepted == 0
|
|
94
|
+
assert stats.bytes_accepted >= len(payload)
|
|
95
|
+
finally:
|
|
96
|
+
server.stop()
|
|
97
|
+
|
|
98
|
+
|
|
55
99
|
@pytest.mark.integration
|
|
56
100
|
def test_tcp_client_loopback_smoke():
|
|
57
101
|
if not RUN_LOOPBACK_TESTS:
|
wirestead-0.9.3/VCPKG_BASELINE
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
6d9d7df564a1ccdaa994e4ad39ccd4a32360867b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
v0.9.3
|
wirestead-0.9.3/docs/api.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# API
|
|
2
|
-
|
|
3
|
-
The Python package exposes the pybind11 API migrated from the Wirestead C++ core
|
|
4
|
-
repository.
|
|
5
|
-
|
|
6
|
-
```python
|
|
7
|
-
import wirestead
|
|
8
|
-
|
|
9
|
-
client = wirestead.TcpClient("127.0.0.1", 9000)
|
|
10
|
-
server = wirestead.TcpServer(9000)
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The compiled extension is installed as `wirestead._core`.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.9.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|