aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/client-communication.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix-build-coordinator/client-communication.scm')
-rw-r--r--guix-build-coordinator/client-communication.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm
index 698a62e..5d443d8 100644
--- a/guix-build-coordinator/client-communication.scm
+++ b/guix-build-coordinator/client-communication.scm
@@ -493,6 +493,24 @@
'()))
#:threshold 10)))
(render-json submit-build-result))))
+ (('GET "state")
+ ;; Use a write transaction here to get a snapshot of the state plus the
+ ;; state-id
+ (render-json
+ (datastore-call-with-transaction
+ datastore
+ (lambda (_)
+ `((state_id . ,(build-coordinator-get-state-id build-coordinator))
+ (agents . ,(list->vector
+ (map
+ (lambda (agent-details)
+ `(,@agent-details
+ (builds
+ . ,(list->vector
+ (datastore-list-agent-builds
+ datastore
+ (assq-ref agent-details 'uuid))))))
+ (datastore-list-agents datastore)))))))))
(('GET "events")
(list (build-response
#:code 200