diff options
-rw-r--r-- | nar-herder/database.scm | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/nar-herder/database.scm b/nar-herder/database.scm index 7c88c8c..239a7e7 100644 --- a/nar-herder/database.scm +++ b/nar-herder/database.scm @@ -78,12 +78,12 @@ database-insert-scheduled-cached-narinfo-removal)) (define-record-type <database> - (make-database database-file reader-thread-channel writer-thread-channel + (make-database database-file reader-thread-set writer-thread-set metrics-registry) database? (database-file database-file) - (reader-thread-channel database-reader-thread-channel) - (writer-thread-channel database-writer-thread-channel) + (reader-thread-set database-reader-thread-set) + (writer-thread-set database-writer-thread-set) (metrics-registry database-metrics-registry)) (define* (db-open database @@ -296,7 +296,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS (sqlite-close db))) - (let ((reader-thread-channel + (let ((reader-thread-set (make-worker-thread-set (lambda () (let ((db @@ -342,7 +342,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS proc) (current-error-port)))))) - (writer-thread-channel + (writer-thread-set (if readonly? #f (make-worker-thread-set @@ -395,8 +395,8 @@ CREATE UNIQUE INDEX IF NOT EXISTS (current-error-port)))))))) (make-database database-file - reader-thread-channel - writer-thread-channel + reader-thread-set + writer-thread-set metrics-registry))) (define (update-database-metrics! database) @@ -446,7 +446,7 @@ PRAGMA optimize;"))) (retry-on-error (lambda () (call-with-worker-thread - (database-writer-thread-channel database) + (database-writer-thread-set database) (lambda (db) (db-optimize db @@ -582,8 +582,8 @@ PRAGMA optimize;"))) (match (call-with-worker-thread ((if readonly? - database-reader-thread-channel - database-writer-thread-channel) + database-reader-thread-set + database-writer-thread-set) database) (lambda (db) (if (%current-transaction-proc) @@ -605,7 +605,7 @@ PRAGMA optimize;"))) (sqlite-close db))) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (sqlite-exec db @@ -959,7 +959,7 @@ DELETE FROM narinfo_tags WHERE narinfo_id = :narinfo_id" "select_narinfo" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -991,7 +991,7 @@ WHERE id = :id" "select_narinfo_by_hash" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1024,7 +1024,7 @@ WHERE substr(store_path, 12, 32) = :hash" "select_narinfo_contents_by_hash" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1046,7 +1046,7 @@ SELECT id, contents FROM narinfos WHERE substr(store_path, 12, 32) = :hash" (define (database-count-recent-changes database) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1063,7 +1063,7 @@ SELECT COUNT(*) FROM recent_changes" (define* (database-select-recent-changes database after-date #:key (limit 8192)) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1093,7 +1093,7 @@ LIMIT :limit" (define (database-select-latest-recent-change-datetime database) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1111,7 +1111,7 @@ SELECT datetime FROM recent_changes ORDER BY datetime DESC LIMIT 1" (define (database-get-recent-changes-id-for-deletion database limit) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1133,7 +1133,7 @@ SELECT id FROM recent_changes ORDER BY datetime DESC LIMIT 1 OFFSET :offset" (define (database-delete-recent-changes-with-id-below database id) (call-with-worker-thread - (database-writer-thread-channel database) + (database-writer-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1153,7 +1153,7 @@ DELETE FROM recent_changes WHERE id < :id" (define (database-select-narinfo-for-file database narinfo-file-url) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1188,7 +1188,7 @@ WHERE narinfo_files.url = :url" "select_narinfo_files" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1223,7 +1223,7 @@ WHERE substr(narinfos.store_path, 12, 32) = :hash" "select_narinfo_files_by_narinfo_id" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1254,7 +1254,7 @@ WHERE narinfos.id = :narinfo_id" (define (database-fold-all-narinfo-files database proc init) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1288,7 +1288,7 @@ FROM narinfo_files" (define (database-count-narinfo-files database) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1309,7 +1309,7 @@ SELECT COUNT(*) FROM narinfo_files" size compression) (call-with-worker-thread - (database-writer-thread-channel database) + (database-writer-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1340,7 +1340,7 @@ INSERT INTO cached_narinfo_files ( "select_cached_narinfo_file_by_hash" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1377,7 +1377,7 @@ WHERE substr(narinfos.store_path, 12, 32) = :hash "select_cached_narinfo_file_by_narinfo_id" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1419,7 +1419,7 @@ WHERE narinfo_id = :narinfo_id" "select_cached_narinfo_file_by_narinfo_id_and_compression" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1456,7 +1456,7 @@ WHERE narinfo_id = :narinfo_id proc init) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1485,7 +1485,7 @@ INNER JOIN narinfos (define (database-remove-cached-narinfo-file database narinfo-id compression) (call-with-worker-thread - (database-writer-thread-channel database) + (database-writer-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1510,7 +1510,7 @@ WHERE narinfo_id = :narinfo_id "select_scheduled_narinfo_removal" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1542,7 +1542,7 @@ WHERE narinfo_id = :narinfo_id" "select_scheduled_narinfo_removal" (lambda () (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1570,7 +1570,7 @@ WHERE cached_narinfo_file_id = :cached_narinfo_file_id" (define (database-delete-scheduled-cached-narinfo-removal database cached-narinfo-file-id) (call-with-worker-thread - (database-writer-thread-channel database) + (database-writer-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1591,7 +1591,7 @@ RETURNING 1" (define (database-select-oldest-scheduled-cached-narinfo-removal database) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1631,7 +1631,7 @@ LIMIT 1" (define (database-count-scheduled-cached-narinfo-removal database) (call-with-worker-thread - (database-reader-thread-channel database) + (database-reader-thread-set database) (lambda (db) (let ((statement (sqlite-prepare @@ -1651,7 +1651,7 @@ SELECT COUNT(*) FROM scheduled_cached_narinfo_removal" cached-narinfo-file-id removal-datetime) (call-with-worker-thread - (database-writer-thread-channel database) + (database-writer-thread-set database) (lambda (db) (let ((statement (sqlite-prepare |