You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-3Lines changed: 27 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,16 +20,40 @@ The state-signals PyPI package is available [here](https://pypi.org/project/stat
20
20
21
21
To install, run `pip install state-signals`
22
22
23
-
# REQUIREMENTS
23
+
# Requirements
24
24
The use of this module requires the existence of an accessible redis server.
25
25
- Redis can easily be installed with a `yum install redis` (or replace yum with package manager of choice).
26
26
27
27
A redis server can be started with the `redis-server` command.
28
28
- The default port is 6379 (also default for state-signals), but can be changed with `--port (port)`
29
29
- A config file can also be used for greater control/detail `redis-server \path\to\config`
30
-
- Example/default config available (here)[https://download.redis.io/redis-stable/redis.conf]
30
+
- Example config available [here](https://download.redis.io/redis-stable/redis.conf)
31
31
32
32
See https://redis.io/ for more details and usage
33
33
34
-
# PROTOCOL / BEHAVIORS
34
+
# Protocol / Behaviors
35
35
36
+
The `Signal` and `Response` dataclasses define the exact fields/format of signal and response payloads.
37
+
38
+
Publishing, receiving, and responding mechanisms are all detailed in `SignalExporter` and `SignalResponder` documentation. Below are details on the subscribing/awaiting protocol.
39
+
40
+
Accept Subscribers and Awaiting Responses:
41
+
- Using the `SignalExporter`, call an `exporter.initialize(legal_events, ...)`
42
+
- Initialization will start the subscriber listener and establish legal event names
43
+
- It will also publish an "initialization" state signal
44
+
- Responders can then respond to the "initialization" signal to be added to the list of subs
45
+
- Note: A responder can subscribe at any point, unless a "shutdown" signal has been published after the initialization
46
+
- The `SignalExporter` will now wait for (up until timeout) and read the responses of the subscribers after publishing any further signals with `exporter.publish_signal(event, ...)`
47
+
- When finished, calling `exporter.shutdown(...)` will stop the subscriber listener, wipe the subscriber list, and publish a "shutdown" signal
48
+
- This signal publish will NOT listen for responses
49
+
50
+
Sending Responses
51
+
- Receiving signals and sending responses can be done with the `SignalResponder`
52
+
- To respond to a signal, simply use the `respond` method and pass in the `publisher_id` of the signal's publisher, and pass in the `event` being responded to.
53
+
- (COMING SOON) `srespond(signal, ...)`: A method where the user can simply pass in the received signal object they wish to respond to instead of the signal's id/event
54
+
- Responding to an "initialization" signal will subscribe the responder to that specific publisher, which will now await responses from the responder for any future signals published.
55
+
- NOTE: When responding to an "initialization" signal, a Response-Action-Success (RAS) code is not necessary
56
+
- For any future responses to that publisher's signals, an RAS code will be necessary, and will indicate to the publisher whether or not the responder was successful in acting upon the signal
57
+
- See documentation for more details on RAS codes
58
+
59
+
See the [full documentation](https://distributed-system-analysis.github.io/state-signals/) for further details, options, and more
0 commit comments