diff options
author | Christopher Baines <mail@cbaines.net> | 2020-05-19 18:49:31 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-05-19 18:49:31 +0100 |
commit | d5d30b17f678f6b0f7de45ba4fee2a5090b0ee8f (patch) | |
tree | 3dfa62fd0db7a1a85903ada0592f51d24a270f91 /guix-build-coordinator/datastore | |
parent | 6254450177def40f3d9b51265963ef606f9870ed (diff) | |
download | build-coordinator-d5d30b17f678f6b0f7de45ba4fee2a5090b0ee8f.tar build-coordinator-d5d30b17f678f6b0f7de45ba4fee2a5090b0ee8f.tar.gz |
Improve handling of submitting builds
Don't always substitute the derivation, just fetch it if it doesn't exist in
the database. Also just use the name of the derivation, only read it from the
disk when it needs storing in the database.
Diffstat (limited to 'guix-build-coordinator/datastore')
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index 7f06b89..b566180 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -31,6 +31,7 @@ datastore-store-setup-failure datastore-store-setup-failure/missing-inputs datastore-list-setup-failure-missing-inputs + datastore-find-derivation datastore-find-derivation-system datastore-find-derivation-inputs datastore-find-derivation-outputs @@ -1368,6 +1369,33 @@ SELECT name, id FROM derivation_outputs WHERE derivation_name = :derivation_name outputs))) +(define-method (datastore-find-derivation + (datastore <sqlite-datastore>) + name) + (call-with-worker-thread + (slot-ref datastore 'worker-reader-thread-channel) + (lambda (db) + (let ((statement + (sqlite-prepare + db + " +SELECT system +FROM derivations +WHERE name = :name"))) + + (sqlite-bind-arguments + statement + #:name name) + + (let ((result + (match (sqlite-step statement) + (#f #f) + (#(system) + `((system . ,system)))))) + (sqlite-reset statement) + + result))))) + (define-method (datastore-find-derivation-outputs (datastore <sqlite-datastore>) derivation-name) |