Type definition: replace wrong fsymbol type by function

This commit is contained in:
kimory 2022-10-25 12:01:25 +02:00
parent 10ba9a1a72
commit 050db0ed8b

View File

@ -101,7 +101,7 @@
; Example: "./storage/cars/" "name" #'vehicle-name object -> "./storage/cars/indexes/by_name/Corvet".
(defun db/index/get-symlink-path (dbpath index-name fsymbol object)
(declare (type string dbpath index-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(let* ((value (funcall fsymbol object))
(symlink-basename (value->safe-string value)))
(concatenate 'string
@ -114,7 +114,7 @@
; :hard nil)
(defun db/index/new (dbpath index-name fsymbol object file-name)
(declare (type string dbpath index-name file-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(let ((symlink-path (db/index/get-symlink-path dbpath index-name fsymbol object)))
(declare (type string symlink-path))
@ -125,14 +125,14 @@
(defun db/index/del (dbpath index-name fsymbol object)
(declare (type string dbpath index-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(delete-file (db/index/get-symlink-path dbpath index-name fsymbol object)))
; Example: "./storage/cars/" "color" #'vehicle-color object "0000000015".
; -> "./storage/cars/partitions/by_color/Red/0000000015".
(defun db/partition/get-symlink-path (dbpath partition-name fsymbol object file-name)
(declare (type string dbpath partition-name file-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(let* ((object-attribute (funcall fsymbol object))
(safe-value (value->safe-string object-attribute))
; example: "./storage/cars/partitions/by_color/Red/"
@ -145,7 +145,7 @@
; :hard nil)
(defun db/partition/new (dbpath partition-name fsymbol object file-name)
(declare (type string dbpath partition-name file-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(let ((symlink-path
(db/partition/get-symlink-path dbpath partition-name fsymbol object file-name)))
@ -158,12 +158,12 @@
(defun db/partition/del (dbpath partition-name fsymbol object file-basename)
(declare (type string dbpath partition-name file-basename))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(delete-file (db/partition/get-symlink-path dbpath partition-name fsymbol object file-basename)))
(defun db/new-index (database index-name fsymbol)
(declare (type string index-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(let ((dbpath (db-path database))
(index-name (value->safe-string index-name)))
; create a directory for the indexes
@ -182,7 +182,7 @@
(defun db/partition/update (dbpath partition-name fsymbol object file-name old-object)
(declare (type string dbpath partition-name file-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(let ((new-value (funcall fsymbol object))
(old-value (funcall fsymbol old-object)))
(if (not (equal new-value old-value))
@ -194,7 +194,7 @@
(defun db/new-partition (database partition-name fsymbol)
(declare (type string partition-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(let ((dbpath (db-path database))
(partition-name (value->safe-string partition-name)))
; create a directory for the partitions
@ -285,7 +285,7 @@
(defun db/index/update (dbpath index-name fsymbol object file-name old-object)
(declare (type string dbpath index-name file-name))
(declare (type symbol fsymbol))
(declare (type function fsymbol))
(let ((new-value (funcall fsymbol object))
(old-value (funcall fsymbol old-object))
(symlink-path (db/index/get-symlink-path dbpath index-name fsymbol object)))