Skip to content

Commit 9478360

Browse files
committed
Doc overhaul complete and version update
1 parent aa55cdc commit 9478360

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,40 @@ The state-signals PyPI package is available [here](https://pypi.org/project/stat
2020

2121
To install, run `pip install state-signals`
2222

23-
# REQUIREMENTS
23+
# Requirements
2424
The use of this module requires the existence of an accessible redis server.
2525
- Redis can easily be installed with a `yum install redis` (or replace yum with package manager of choice).
2626

2727
A redis server can be started with the `redis-server` command.
2828
- The default port is 6379 (also default for state-signals), but can be changed with `--port (port)`
2929
- 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)
3131

3232
See https://redis.io/ for more details and usage
3333

34-
# PROTOCOL / BEHAVIORS
34+
# Protocol / Behaviors
3535

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

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "state-signals"
3-
version = "0.1.4"
3+
version = "0.1.5"
44
description = "Package for easy management of state/event signal publishing, subscribing, and responding"
55

66
license = "GPL"
@@ -9,14 +9,14 @@ authors = [
99
"Mustafa Eyceoz <[email protected]>"
1010
]
1111

12-
readme = 'README.md' # Markdown files are supported
12+
readme = 'README.md'
1313

1414
repository = "https://github.com/distributed-system-analysis/state-signals"
1515
homepage = "https://github.com/distributed-system-analysis/state-signals"
1616

1717
keywords = ['state', 'event', 'signal', 'publish', 'subscribe']
1818

1919
[tool.poetry.dependencies]
20-
python = "^3.6" # Compatible python versions must be declared here
20+
python = "^3.6"
2121
redis = "^3.5"
2222
dataclasses = "^0.8"

0 commit comments

Comments
 (0)