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

feat(workers): add activate/deactivate [NET-587] #1889

Merged
merged 25 commits into from
Nov 27, 2023
Merged

Conversation

justprosh
Copy link
Member

@justprosh justprosh commented Nov 9, 2023

Description

Provide an API to activate and deactivate workers.
Deactivation stops all spells (sets empty trigger configs) and causes all incoming particles to that worker to be dropped.
Activation starts only installation-spell, which will start all of the others.
Activation and deactivation only allowed for the peer itself (i.e., decider spell) and management peer id.

Motivation

We need to pause deals in case of insufficient funds.

Proposed Changes

Added builtins:

service Worker:
  activate(deal_id: string)
  deactivate(deal_id: string)
  is_active(deal_id: string) -> bool

Additional Notes

  • KeyManager refactoring
    • store keypairs and worker info separately
    • update worker status without locking everything
    • run key_manager methods in blocking pool
  • DEPRECATE Worker.get_peer_id
  • Make deal_id REQUIRED for all Worker operations

Checklist

  • The code follows the project's coding conventions and style guidelines.
  • All tests related to the changes have passed successfully.
  • Documentation has been updated to reflect the changes (if applicable).
  • All new and existing unit tests have passed.
  • I have self-reviewed my code and ensured its quality.
  • I have added/updated necessary comments to aid understanding.

Reviewer Checklist

  • Code has been reviewed for quality and adherence to guidelines.
  • Tests have been reviewed and are sufficient to validate the changes.
  • Documentation has been reviewed and is up to date.
  • Any questions or concerns have been addressed.

@justprosh justprosh changed the title feat(workers): add activate/deactivate feat(workers): add activate/deactivate [NET-587] Nov 9, 2023
Copy link

linear bot commented Nov 9, 2023

NET-587 Activate/deactivate deals [workers]

  • stop spells
  • drop particles

@justprosh justprosh marked this pull request as ready for review November 13, 2023 12:53
@justprosh justprosh added the e2e Run e2e workflow label Nov 13, 2023
@justprosh justprosh requested review from folex and kmd-fl and removed request for folex November 13, 2023 12:53
crates/key-manager/src/key_manager.rs Show resolved Hide resolved
sorcerer/src/worker_builins.rs Outdated Show resolved Hide resolved
sorcerer/src/worker_builins.rs Outdated Show resolved Hide resolved
sorcerer/src/worker_builins.rs Outdated Show resolved Hide resolved
sorcerer/src/worker_builins.rs Outdated Show resolved Hide resolved
sorcerer/src/worker_builins.rs Outdated Show resolved Hide resolved
sorcerer/src/worker_builins.rs Outdated Show resolved Hide resolved
crates/nox-tests/tests/spells.rs Show resolved Hide resolved
crates/nox-tests/tests/spells.rs Show resolved Hide resolved
crates/key-manager/src/key_manager.rs Outdated Show resolved Hide resolved
crates/key-manager/src/persistence.rs Outdated Show resolved Hide resolved
crates/key-manager/src/persistence.rs Outdated Show resolved Hide resolved
crates/key-manager/src/persistence.rs Outdated Show resolved Hide resolved
crates/key-manager/src/persistence.rs Outdated Show resolved Hide resolved
crates/key-manager/src/persistence.rs Outdated Show resolved Hide resolved
@justprosh justprosh requested a review from folex November 24, 2023 10:54
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
aquamarine/src/plumber.rs Outdated Show resolved Hide resolved
@justprosh justprosh requested a review from folex November 27, 2023 18:12
@justprosh justprosh merged commit 0883ab8 into master Nov 27, 2023
15 checks passed
@justprosh justprosh deleted the activate_deactivate branch November 27, 2023 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants