blob: dc4fec6a97935f0b47e1ac5bc1824b2557ac73eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
(define-module (guix-build-coordinator datastore)
#:use-module (srfi srfi-1)
#:use-module (oop goops)
#:use-module (guix-build-coordinator datastore abstract)
#:use-module (guix-build-coordinator datastore sqlite)
#:use-module (guix-build-coordinator datastore postgresql)
#:duplicates (merge-generics)
#:export (database-uri->datastore
datastore-find-build-output))
(re-export datastore-optimize)
(re-export datastore-spawn-fibers)
(re-export datastore-initialise-metrics!)
(re-export datastore-update-metrics!)
(re-export datastore-update)
(re-export make-transaction-rollback-exception)
(re-export datastore-call-with-transaction)
(re-export datastore-store-derivation)
(re-export datastore-insert-build)
(re-export datastore-cancel-build)
(re-export datastore-update-unprocessed-builds-with-lower-derived-priorities)
(re-export datastore-update-build-priority)
(re-export datastore-new-agent)
(re-export datastore-list-agents)
(re-export datastore-set-agent-active)
(re-export datastore-find-agent-status)
(re-export datastore-update-agent-status)
(re-export datastore-find-agent)
(re-export datastore-find-agent-by-name)
(re-export datastore-insert-dynamic-auth-token)
(re-export datastore-dynamic-auth-token-exists?)
(re-export datastore-fetch-agent-tags)
(re-export datastore-count-build-results)
(re-export datastore-insert-build-result)
(re-export datastore-update-unprocessed-builds-for-build-success)
(re-export datastore-remove-build-allocation)
(re-export datastore-mark-build-as-processed)
(re-export datastore-delete-relevant-outputs-from-unbuilt-outputs)
(re-export datastore-store-output-metadata)
(re-export datastore-store-build-start)
(re-export datastore-find-build-starts)
(re-export datastore-count-setup-failures)
(re-export datastore-list-setup-failures-for-build)
(re-export datastore-fetch-setup-failures)
(re-export datastore-list-unbuilt-derivation-outputs)
(re-export datastore-list-build-outputs)
(re-export datastore-build-exists-for-derivation-outputs?)
(re-export datastore-build-required-by-another?)
(re-export datastore-list-related-derivations-with-no-build-for-outputs)
(re-export datastore-list-failed-builds-with-blocking-count)
(re-export datastore-list-builds-for-derivation-recursive-inputs)
(re-export datastore-store-setup-failure)
(re-export datastore-store-setup-failure/missing-inputs)
(re-export datastore-list-setup-failure-missing-inputs)
(re-export datastore-new-agent-password)
(re-export datastore-agent-password-exists?)
(re-export datastore-agent-list-passwords)
(re-export datastore-replace-agent-tags)
(re-export datastore-count-builds)
(re-export datastore-for-each-build)
(re-export datastore-find-build)
(re-export datastore-fold-builds)
(re-export datastore-find-unprocessed-build-entry)
(re-export datastore-insert-build-tags)
(re-export datastore-fetch-build-tags)
(re-export datastore-find-build-result)
(re-export datastore-find-build-derivation-system)
(re-export datastore-count-builds-for-derivation)
(re-export datastore-list-processed-builds)
(re-export datastore-list-unprocessed-builds)
(re-export datastore-find-deferred-build)
(re-export datastore-fetch-prioritised-unprocessed-builds)
(re-export datastore-insert-unprocessed-hook-event)
(re-export datastore-count-unprocessed-hook-events)
(re-export datastore-list-unprocessed-hook-events)
(re-export datastore-find-unprocessed-hook-event)
(re-export datastore-delete-unprocessed-hook-event)
(re-export datastore-list-agent-builds)
(re-export datastore-find-derivation)
(re-export datastore-find-derivation-outputs)
(re-export datastore-find-derivation-output-details)
(re-export datastore-find-derivation-system)
(re-export datastore-find-derivation-inputs)
(re-export datastore-find-recursive-derivation-input-outputs)
(re-export datastore-find-derivation-for-output)
(re-export datastore-list-builds-for-output)
(re-export datastore-list-builds-for-output-and-system)
(re-export datastore-agent-for-build)
(re-export datastore-count-allocated-builds)
(re-export datastore-agent-requested-systems)
(re-export datastore-update-agent-requested-systems)
(re-export datastore-fetch-build-to-allocate)
(re-export datastore-check-if-derivation-conflicts?)
(re-export datastore-insert-to-allocated-builds)
(define* (database-uri->datastore database
#:key
metrics-registry
worker-thread-log-exception?)
(cond
((string-prefix? "pg://" database)
(postgresql-datastore database))
((string-prefix? "sqlite://" database)
(sqlite-datastore database
#:metrics-registry metrics-registry
#:worker-thread-log-exception?
worker-thread-log-exception?))
(else
(error
(simple-format #f "Unknown database ~A" database)))))
(define (datastore-find-build-output datastore build-id output-name)
(let* ((build (datastore-find-build datastore build-id))
(outputs (datastore-find-derivation-outputs
datastore
(assq-ref build 'derivation-name))))
(any (lambda (output)
(if (string=? (assq-ref output 'name) output-name)
(assq-ref output 'output)
#f))
outputs)))
|