aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2025-05-21 17:29:14 +0100
committerChristopher Baines <mail@cbaines.net>2025-05-21 17:32:58 +0100
commit1a8193fb2cf156793b74e28baac12112442f423f (patch)
treeb162da9954beb089312ab59f7bf822ebad49ce23
parent64d36bef58150697e62ce46c8b952725dd585a9c (diff)
downloadnar-herder-1a8193fb2cf156793b74e28baac12112442f423f.tar
nar-herder-1a8193fb2cf156793b74e28baac12112442f423f.tar.gz
Adjust for Guile Knots changes
-rw-r--r--guix-dev.scm42
-rw-r--r--nar-herder/cached-compression.scm52
-rw-r--r--nar-herder/database.scm7
3 files changed, 47 insertions, 54 deletions
diff --git a/guix-dev.scm b/guix-dev.scm
index 8d3151c..a39f099 100644
--- a/guix-dev.scm
+++ b/guix-dev.scm
@@ -46,7 +46,7 @@
(srfi srfi-1))
(define guile-knots
- (let ((commit "d572f591a3c136bfc7b23160e16381c92588f8d9")
+ (let ((commit "016f37f108ca19da3664516baa97e907aa972b90")
(revision "1"))
(package
(name "guile-knots")
@@ -58,18 +58,18 @@
(commit commit)))
(sha256
(base32
- "0g85frfniblxb2cl81fg558ic3cxvla7fvml08scjgbbxn8151gv"))
+ "12j3l9p4acf47cjpfzm41ddxyxs1v6vlfa2vrymdd4gdday62xfn"))
(file-name (string-append name "-" version "-checkout"))))
(build-system gnu-build-system)
(native-inputs
(list pkg-config
autoconf
automake
- guile-3.0
+ guile-next
guile-lib
- guile-fibers))
+ guile-fibers-next))
(inputs
- (list guile-3.0))
+ (list guile-next))
(propagated-inputs
(list guile-fibers))
(home-page "https://git.cbaines.net/guile/knots")
@@ -84,23 +84,23 @@
(source #f)
(build-system gnu-build-system)
(inputs
- `(("guix" ,guix)
- ("guile-json" ,guile-json-4)
- ("guile-fibers" ,guile-fibers-1.3)
- ("guile-knots" ,guile-knots)
- ("guile-gcrypt" ,guile-gcrypt)
- ("guile-readline" ,guile-readline)
- ("guile-lzlib" ,guile-lzlib)
- ("guile" ,@(assoc-ref (package-native-inputs guix) "guile"))
- ("guile-sqlite3" ,guile-sqlite3)
- ("guile-lib" ,guile-lib)
- ("guile-prometheus" ,guile-prometheus)
- ("sqlite" ,sqlite)))
+ (list guix
+ guile-json-4
+ guile-fibers-next
+ guile-knots
+ guile-gcrypt
+ guile-readline
+ guile-lzlib
+ guile-next
+ guile-sqlite3
+ guile-lib
+ guile-prometheus
+ sqlite))
(native-inputs
- `(("autoconf" ,autoconf)
- ("automake" ,automake)
- ("pkg-config" ,pkg-config)
- ("nginx" ,nginx)))
+ (list autoconf
+ automake
+ pkg-config
+ nginx))
(synopsis "TODO")
(description "TODO")
(home-page "TODO")
diff --git a/nar-herder/cached-compression.scm b/nar-herder/cached-compression.scm
index 0bc0a82..1c5c517 100644
--- a/nar-herder/cached-compression.scm
+++ b/nar-herder/cached-compression.scm
@@ -32,6 +32,7 @@
#:use-module (fibers channels)
#:use-module (fibers operations)
#:use-module (knots timeout)
+ #:use-module (knots parallelism)
#:use-module (knots thread-pool)
#:use-module (knots non-blocking)
#:use-module (web uri)
@@ -206,14 +207,10 @@
(define channel
(make-channel))
- (let ((process-job
- count-jobs
- count-threads
- list-jobs
- (create-work-queue cached-compression-workers
- (lambda (thunk)
- (thunk))
- #:name "cached compression")))
+ (let ((thread-pool
+ (make-fixed-size-thread-pool
+ cached-compression-workers
+ #:name "cached compression")))
(define (consider-narinfo cached-bytes-by-compression
usage-hash-table
@@ -288,28 +285,27 @@
directory-max-size)
#t)))
missing-compressions)))
- (for-each
+ (fibers-for-each
(lambda (compression)
- (spawn-fiber
+ (call-with-thread
+ thread-pool
(lambda ()
- (process-job
- (lambda ()
- (let ((new-bytes
- (make-compressed-nar
- narinfo-files
- nar-source
- enabled-cached-compressions
- compression
- #:level (assq-ref
- (assq-ref enabled-cached-compressions
- compression)
- 'level))))
- (put-message channel
- (list 'cached-narinfo-added
- narinfo-id
- compression
- new-bytes
- #f))))))))
+ (let ((new-bytes
+ (make-compressed-nar
+ narinfo-files
+ nar-source
+ enabled-cached-compressions
+ compression
+ #:level (assq-ref
+ (assq-ref enabled-cached-compressions
+ compression)
+ 'level))))
+ (put-message channel
+ (list 'cached-narinfo-added
+ narinfo-id
+ compression
+ new-bytes
+ #f))))))
compressions-with-space)))))))
(spawn-fiber
diff --git a/nar-herder/database.scm b/nar-herder/database.scm
index f41ba21..2b7b46a 100644
--- a/nar-herder/database.scm
+++ b/nar-herder/database.scm
@@ -22,8 +22,6 @@
#:use-module (srfi srfi-19)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
- #:use-module (ice-9 threads)
- #:use-module (ice-9 exceptions)
#:use-module (web uri)
#:use-module (sqlite3)
#:use-module (fibers)
@@ -31,7 +29,6 @@
#:use-module (prometheus)
#:use-module (guix store)
#:use-module (guix narinfo)
- #:use-module (guix derivations)
#:use-module (nar-herder utils)
#:export (setup-database
update-database-metrics!
@@ -297,7 +294,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS
(sqlite-close db)))
(let ((reader-thread-pool
- (make-thread-pool
+ (make-fixed-size-thread-pool
;; Use a minimum of 2 and a maximum of 8 threads
reader-threads
#:thread-initializer
@@ -346,7 +343,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS
(writer-thread-pool
(if readonly?
#f
- (make-thread-pool
+ (make-fixed-size-thread-pool
;; SQLite doesn't support parallel writes
1
#:thread-initializer