Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal payloads (values) #10

Closed
josephbirkner opened this issue Nov 12, 2018 · 1 comment
Closed

Signal payloads (values) #10

josephbirkner opened this issue Nov 12, 2018 · 1 comment
Labels
core ⚙️ Issues that concern the core ravestate lib/API

Comments

@josephbirkner
Copy link
Collaborator

josephbirkner commented Nov 12, 2018

For many states, it is logically necesssary to know a property value from the exact moment when a changed-signal was emitted; not from the rather arbitrary point in time when the state is actually activated. For example, a state might handle the addition of an interlocutor by reacting to interloc:all:pushed. However, multiple interlocutors might enter Roboy's vision simultaneously, at which point it becomes intractable not know which of the interlocutors is new and which is not.

For this purpose, signal payloads (or "values") are introduced through the following APIs:

  • A payload (e.g. an interlocutor id) may be submitted through the state return value state.emit(payload)
  • A payload may be retrieved through special context wrapper entries for each trigger signal: An entry always exists, even for triggers which did not contribute to the activation. An error is only raised for signals that are not mentioned as triggers at all.
  • The payload for the :changed signal is always the new property value. The value for the :pushed and :popped signal is always the full property path of the created/deleted property.
@josephbirkner josephbirkner changed the title Signal payloads Signal payloads (values) Nov 15, 2018
@josephbirkner josephbirkner modified the milestones: Interlocutor, Multiparty Nov 15, 2018
@josephbirkner josephbirkner removed this from the Multiparty milestone Nov 15, 2018
@josephbirkner josephbirkner added core ⚙️ Issues that concern the core ravestate lib/API telegram 💌 and removed enhancement telegram 💌 labels Jan 28, 2019
@josephbirkner
Copy link
Collaborator Author

See #53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core ⚙️ Issues that concern the core ravestate lib/API
Projects
None yet
Development

No branches or pull requests

1 participant