diff options
author | Christopher Baines <mail@cbaines.net> | 2020-07-01 17:43:49 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-07-01 17:43:49 +0100 |
commit | ab5760aa633be66b7444a4896be53f31a101adcf (patch) | |
tree | d8cfc60fd0e61bbd270d8ca9077b7db38c127289 | |
parent | 9be68c01b14413974598ba73fa41d80fa3eb15ba (diff) | |
download | build-coordinator-ab5760aa633be66b7444a4896be53f31a101adcf.tar build-coordinator-ab5760aa633be66b7444a4896be53f31a101adcf.tar.gz |
Add datastore-for-each-build
-rw-r--r-- | guix-build-coordinator/datastore.scm | 1 | ||||
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/guix-build-coordinator/datastore.scm b/guix-build-coordinator/datastore.scm index e888387..eecff9c 100644 --- a/guix-build-coordinator/datastore.scm +++ b/guix-build-coordinator/datastore.scm @@ -32,6 +32,7 @@ (re-export datastore-new-agent-password) (re-export datastore-agent-password-exists?) (re-export datastore-count-builds) +(re-export datastore-for-each-build) (re-export datastore-find-build) (re-export datastore-find-build-result) (re-export datastore-list-builds-for-derivation) diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index e8d1ee2..9c9172a 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -18,6 +18,7 @@ datastore-list-builds-for-derivation-recursive-inputs datastore-store-build datastore-count-builds + datastore-for-each-build datastore-find-build datastore-find-build-result datastore-list-builds-for-derivation @@ -807,6 +808,29 @@ GROUP BY derivations.system"))) result))))) +(define-method (datastore-for-each-build + (datastore <sqlite-datastore>) + proc) + (call-with-worker-thread + (slot-ref datastore 'worker-reader-thread-channel) + (lambda (db) + (let ((statement + (sqlite-prepare + db + " +SELECT uuid FROM builds ORDER BY uuid"))) + + (let loop ((row (sqlite-step statement))) + (match row + (#(uuid) + (proc uuid) + + (loop (sqlite-step statement))) + (#f + (sqlite-reset statement) + + #t))))))) + (define-method (datastore-find-build (datastore <sqlite-datastore>) uuid) |