services/device/device: globify the update command

Remove the old cmdUpdate and cmdUpdateAll, and add a shiny new cmdUpdate in its
own file (update.go) that uses the glob support. The implementation borrows code
from what used to be updateall.go: instanceIsRunning() is mostly unchanged;
updateInstance() and updateInstallation() are altered (dare I say improved and
simplified).

Also add a unit test which previously didn't exist.

Supporting changes to glob.go:

add context to globHandler (needed if the handler is to make RPCs)

add flag to control handler parallelism; three modes are supported:
1. all handlers are run in parallel
2. all handlers are run sequentially, according to the sort order
3. run all installation handlers first (in parallel), then run all instance
handlers (in parallel)
Modes 2. and 3. are useful for the update command (where we may want more
control on the order of the updates, e.g. do installation before instance)

change the error reporting strategy: the errors from handlers are printed to the
stderr buffer for the respective handler (to ensure grouping with any other
stderr output in the handler); the run() method itself only returns a summary of
the number of errors encountered.

add device service as an option besides installation and instance (since the
device service object occasionally acts like an instance and other times like an
installation); also, we want to sort it deterministically in the glob results.

MultiPart: 2/2

Change-Id: I483255b522295e7de06facdfab0e5b29a4cc0bd1
13 files changed
tree: cf53f217e11b2bcafc35d29f73335149c2aac6dd
  1. cmd/
  2. examples/
  3. internal/
  4. lib/
  5. runtime/
  6. services/
  7. test/
  8. .gitignore
  9. AUTHORS
  10. CONTRIBUTORS
  11. envvar.go
  12. envvar_test.go
  13. LICENSE
  14. PATENTS
  15. README.md
  16. VERSION
README.md

Vanadium

This repository contains a reference implementation of the Vanadium APIs.

Unlike the APIs in https://github.com/vanadium/go.v23, which promises to provide backward compatibility this repository makes no such promises.