API: introduce ability to watch a VM (#351)

* API: introduce ability to watch a VM

* Document ?watch=true for GET /vms/{name} in the OpenAPI specification

* WatchVM: ensure that goroutine is terminated on early return with error

* WatchVM: close channels on goroutine exit

* WatchVM: ensure that we wait for the goroutine after additional barriers

* WatchVM: ignore unexpected keys instead of throwing an error

* WatchVM: perform context-aware writes to a bounded channel

* WatchVM: don't forget to close errCh on goroutine exit too

* WatchVM: don't close readyCh in goroutine to avoid ambiguity

* WatchVM: filter out spurious KVs that signify VM deletion
This commit is contained in:
Nikolay Edigaryev
2025-10-03 21:34:53 +04:00
committed by GitHub
parent cdece3149b
commit c5e0d68a3d
9 changed files with 458 additions and 6 deletions
+3
View File
@@ -16,6 +16,9 @@ type Meta struct {
// It is populated by the Controller with the current time
// when receiving a POST request.
CreatedAt time.Time `json:"createdAt,omitempty"`
// Version is a resource version used internally to implement WatchVM().
Version uint64 `json:"version,omitempty"`
}
type VM struct {