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

☂️ Refactor the watcher for IoT use cases #172

Closed
5 tasks done
manoranjith opened this issue Sep 1, 2021 · 1 comment
Closed
5 tasks done

☂️ Refactor the watcher for IoT use cases #172

manoranjith opened this issue Sep 1, 2021 · 1 comment
Labels
feature New Feature umbrella Umbrella issue
Milestone

Comments

@manoranjith
Copy link
Contributor

manoranjith commented Sep 1, 2021

Context

Currently, the watcher is associated with and coupled to a channel. One local instance of watcher must be started for each channel.

However, for the use case of IoT use cases (described in proposal#3), it is desirable to have a watcher that can

  1. Run either locally or as a remote service.
  2. Is not associated with any specific client/channel. Channels can be associated with/dissociated from a watcher dynamically during runtime.

The design for such a watcher was described in proposal#4. This is an umbrella issue to cover the changes for refactoring the watcher component based on the design in the proposal.

Details

Changes required in usage of watcher

  1. Earlier, user need not initialize a watcher. But now, they should initialize and pass it on as an additional argument to client.New.
  2. Usage of watcher will remain the same. User should call ch.Watch() in a go-routine after establishing the channel.

Preparatory steps

Implementation steps

  1. Define the interfaces for watcher in go-perun/watcher package.
  2. Implement a local watcher in go-perun/local package.
  1. Add statesPub field and setStatesPub method on watcher and call ch.statesPub.Publish whenever a new state is created.
  1. Update the client.New API to take a new watcher instance and store it.
  2. Update the ch.Watch function to use the watcher instance stored in the client.
@manoranjith manoranjith added feature New Feature umbrella Umbrella issue labels Sep 1, 2021
@manoranjith manoranjith changed the title Refactor the watcher for IoT use cases ☂️ Refactor the watcher for IoT use cases Sep 20, 2021
@matthiasgeihs matthiasgeihs added this to the Hyperion milestone Oct 14, 2021
@matthiasgeihs
Copy link
Contributor

Resolved by #248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New Feature umbrella Umbrella issue
Projects
None yet
Development

No branches or pull requests

2 participants