From c0385cd095362cf6b8a22426bf40f487ad0d7674 Mon Sep 17 00:00:00 2001 From: kimory Date: Sun, 16 Oct 2022 13:36:23 +0200 Subject: [PATCH] update: handle partitions --- src/dodb.cl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/dodb.cl b/src/dodb.cl index 39eac35..0aca5a6 100644 --- a/src/dodb.cl +++ b/src/dodb.cl @@ -164,6 +164,16 @@ (format t "db/new-index: symlink already exists, ignoring.~&")))) (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/ (defun db/new-partition (database attribute-name) ; Create a directory for the partitions. @@ -283,12 +293,10 @@ ; handle indexes (loop for index in (db-indexes database) do (db/index/update database index object file-basename old-object)) - ) - ) -; ; handle partitions -; (loop for partition in (db-partitions database) -; do (db/partition/update database partition object file-basename)))) + ; handle partitions + (loop for partition in (db-partitions database) + do (db/partition/update database partition object file-basename old-object)))) ; ; TEST SCENARIO