aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-02-19 15:44:15 +0000
committerChristopher Baines <mail@cbaines.net>2024-04-03 17:30:53 +0100
commitc9cd16c630ccba655b93ff32fd9a99570b4f5373 (patch)
tree3ff7113554ae6a267b104a68369c35bf63325883 /guix
parentc6cc9aeb87014cfb8f1eabb525e28ac633bf7af4 (diff)
downloadguix-c9cd16c630ccba655b93ff32fd9a99570b4f5373.tar
guix-c9cd16c630ccba655b93ff32fd9a99570b4f5373.tar.gz
store: database: Rename a couple of procedures.
These names should be more descriptive. * guix/store/database.scm (path-id): Rename to select-valid-path-id. (sqlite-register): Rename to register-valid-path. (register-items): Update accordingly. Change-Id: I6d4a14d4cde9d71ab34d6ffdbfbfde51b2c0e1db
Diffstat (limited to 'guix')
-rw-r--r--guix/store/database.scm35
1 files changed, 19 insertions, 16 deletions
diff --git a/guix/store/database.scm b/guix/store/database.scm
index dea690ec76..58d3871e85 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -40,8 +40,10 @@
store-database-file
call-with-database
with-database
- path-id
- sqlite-register
+
+ valid-path-id
+
+ register-valid-path
register-items
%epoch
reset-timestamps
@@ -181,9 +183,9 @@ If FILE doesn't exist, create it and initialize it as a new database. Pass
(vector-ref (sqlite-step-and-reset stmt)
0)))
-(define* (path-id db path)
- "If PATH exists in the 'ValidPaths' table, return its numerical
-identifier. Otherwise, return #f."
+(define (valid-path-id db path)
+ "If PATH exists in the 'ValidPaths' table, return its numerical identifier.
+Otherwise, return #f."
(let ((stmt (sqlite-prepare
db
"
@@ -249,7 +251,7 @@ Every store item in REFERENCES must already be registered."
(assert-integer "sqlite-register" (cut >= <> 0) #:time registration-time)
(define id
- (let ((existing-id (path-id db path)))
+ (let ((existing-id (valid-path-id db path)))
(if existing-id
(let ((stmt (sqlite-prepare
db
@@ -284,7 +286,8 @@ VALUES (:path, :hash, :time, :deriver, :size)"
;; Call 'path-id' on each of REFERENCES. This ensures we get a
;; "non-NULL constraint" failure if one of REFERENCES is unregistered.
(add-references db id
- (map (cut path-id db <>) references)))
+ (map (cut valid-path-id db <>) references)))
+
;;;
@@ -361,18 +364,18 @@ typically by adding them as temp-roots."
;; When TO-REGISTER is already registered, skip it. This makes a
;; significant differences when 'register-closures' is called
;; consecutively for overlapping closures such as 'system' and 'bootcfg'.
- (unless (path-id db to-register)
+ (unless (valid-path-id db to-register)
(let-values (((hash nar-size) (nar-sha256 real-file-name)))
(call-with-retrying-transaction db
(lambda ()
- (sqlite-register db #:path to-register
- #:references (store-info-references item)
- #:deriver (store-info-deriver item)
- #:hash (string-append
- "sha256:"
- (bytevector->base16-string hash))
- #:nar-size nar-size
- #:time registration-time))))))
+ (register-valid-path db #:path to-register
+ #:references (store-info-references item)
+ #:deriver (store-info-deriver item)
+ #:hash (string-append
+ "sha256:"
+ (bytevector->base16-string hash))
+ #:nar-size nar-size
+ #:time registration-time))))))
(let* ((prefix (format #f "registering ~a items" (length items)))
(progress (progress-reporter/bar (length items)