aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/datastore.scm
blob: 83fe0cce555fabbbfc9a6defc385b41d2579ace0 (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
(define-module (guix-build-coordinator datastore)
  #:use-module (oop goops)
  #:duplicates (merge-generics)
  #:use-module (guix-build-coordinator datastore abstract)
  #:use-module (guix-build-coordinator datastore sqlite)
  ;; #:use-module (guix-build-coordinator datastore postgresql)
  #:re-export (datastore-store-derivation
               datastore-store-build
               datastore-new-agent
               datastore-list-agents
               datastore-find-agent
               datastore-new-agent-password
               datastore-agent-password-exists?
               datastore-list-unprocessed-builds
               datastore-replace-build-allocation-plan)
  #:export (database-uri->datastore))

(define (database-uri->datastore database)
  (cond
   ((string-prefix? "pg://" database)
    (postgresql-datastore database))
   ((string-prefix? "sqlite://" database)
    (sqlite-datastore database))
   (else
    (error
     (simple-format #f "Unknown database ~A" database)))))