update: handle partitions

draft
kimory 2022-10-16 13:36:23 +02:00
parent ddb6d5b3ff
commit c0385cd095
1 changed files with 13 additions and 5 deletions

View File

@ -164,6 +164,16 @@
(format t "db/new-index: symlink already exists, ignoring.~&")))) (format t "db/new-index: symlink already exists, ignoring.~&"))))
(db-data database))) (db-data database)))
(defun db/partition/update (database partition-name object file-name old-object)
(let ((new-value (get-object-attribute (db-struct-name database) partition-name object))
(old-value (get-object-attribute (db-struct-name database) partition-name old-object)))
(if (not (equal new-value old-value))
(progn
; delete old partition
(db/partition/del database partition-name old-object file-name)
; create new partition
(db/partition/new database partition-name object file-name)))))
; example: db-path/partitions/by_color/ ; example: db-path/partitions/by_color/
(defun db/new-partition (database attribute-name) (defun db/new-partition (database attribute-name)
; Create a directory for the partitions. ; Create a directory for the partitions.
@ -283,12 +293,10 @@
; handle indexes ; handle indexes
(loop for index in (db-indexes database) (loop for index in (db-indexes database)
do (db/index/update database index object file-basename old-object)) do (db/index/update database index object file-basename old-object))
)
)
; ; handle partitions ; handle partitions
; (loop for partition in (db-partitions database) (loop for partition in (db-partitions database)
; do (db/partition/update database partition object file-basename)))) do (db/partition/update database partition object file-basename old-object))))
; ;
; TEST SCENARIO ; TEST SCENARIO