Closed abbiemery closed 1 year ago
Merging #174 (b47a673) into master (bd673a8) will decrease coverage by
0.58%
. The diff coverage is93.82%
.
@@ Coverage Diff @@
## master #174 +/- ##
==========================================
- Coverage 95.21% 94.64% -0.58%
==========================================
Files 43 41 -2
Lines 1295 1306 +11
==========================================
+ Hits 1233 1236 +3
- Misses 62 70 +8
Files Changed | Coverage Δ | |
---|---|---|
...rc/tickit/adapters/specifications/regex_command.py | 96.15% <ø> (ø) |
|
src/tickit/adapters/utils.py | 100.00% <ø> (ø) |
|
src/tickit/adapters/tcp.py | 82.60% <65.00%> (ø) |
|
src/tickit/core/components/system_simulation.py | 94.11% <75.00%> (-3.61%) |
:arrow_down: |
src/tickit/adapters/io/zeromq_push_io.py | 84.93% <90.00%> (ø) |
|
src/tickit/adapters/zmq.py | 90.90% <90.90%> (ø) |
|
src/tickit/core/adapter.py | 91.30% <93.33%> (-0.37%) |
:arrow_down: |
src/tickit/adapters/io/tcp_io.py | 97.67% <97.67%> (ø) |
|
src/tickit/adapters/epics.py | 76.78% <100.00%> (ø) |
|
src/tickit/adapters/http.py | 100.00% <100.00%> (ø) |
|
... and 7 more |
This is a possible change to the way adapters work within tickit. This attempts unifies the adapters in a composed way by seperating out the IO and the device specific handling logic. The idea is that you use an
AdapterContainer
which has both anadapter
(the part that handles the messages) and theio
which does the rest.The
AdapterContainer
acts as the previous adapters did and contains therun_forever
method. Now though, this calls asetup
method in theio
in which theio
takes the specificadapter
that has been provided. Theadapter
andio
are failry coupled given the io needs a specific adapter type to work, eg.class HttpIo(AdapterIo[HttpAdapter]):
. However i was hoping this change provides a clearer divide in developer and user implemented code.In the http example:
As before users would need to write specific adapters for their devices but this should simplifiy their lives a bit as all they now need is the device and device specific methods. For example the http adapter on an iobox:
Then the component config:
Most importantly, and the motivation for this change, is there is no longer a limitation on what an adapter may apply to. This allows us to write an adapter which inspect the components in a system simulation. I put a quick example one I made in the example folder which used a tcpio and commandadapter.
I'd really appreciate opinions on the idea before I commit to it and rewrite half the test suite. I'm particularly not certain on: