UpdateService class

Handles the node-control requests the Hub dispatches (NodeControl).

Every one of these is about the agent, not the machine it runs on. restart restarts the OmnyServer agent; shutdown stops it; update updates what the agent can reach. Nothing here reboots or powers off a host, and nothing should be read as if it did.

  • restart — stop the agent so its supervisor starts it again
  • shutdown — stop the agent, and leave it stopped
  • update — with three targets:
    • os — apply OS package updates via the platform package manager
    • agent — self-update the OmnyServer agent (placeholder: reports the mechanism; full remote self-update is on the roadmap)
    • <package> — update a single named package

Stopping is the caller's to arrange, because only the process that owns the agent's lifecycle can end it: pass onRestartAgent and onStopAgent. An agent wired without them says so rather than reporting a success it did not deliver — which is what this used to do, leaving an operator watching a green result and an untouched node.

Returns (success, message) suitable for a NodeControlHandler.

Constructors

UpdateService({CommandExecutor executor = const ProcessCommandExecutor(), Future<void> onRestartAgent()?, Future<void> onStopAgent()?})
Creates an update service.
const

Properties

executor CommandExecutor
Runs the underlying commands.
final
hashCode int
The hash code for this object.
no setterinherited
onRestartAgent Future<void> Function()?
Stops the agent in a way its supervisor will undo — the agent comes back.
final
onStopAgent Future<void> Function()?
Stops the agent and leaves it stopped.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

handle(NodeControl request) Future<(bool, String)>
Handles a node-control request.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

replyGrace → const Duration
How long to wait before acting, so the answer reaches the Hub first.