Naming convention.
parent
fe41a86eb8
commit
774e9bd436
30
src/dodb.cl
30
src/dodb.cl
|
@ -55,12 +55,15 @@
|
||||||
(concatenate 'string (db-struct-name database) "-" index-name)))
|
(concatenate 'string (db-struct-name database) "-" index-name)))
|
||||||
object))
|
object))
|
||||||
|
|
||||||
(defun db/add/new-link (database index-name object file-name)
|
(defun db/index/get-symlink-path (database index-name object)
|
||||||
|
(concatenate 'string
|
||||||
|
(db-path database)
|
||||||
|
"/by_" index-name "/"
|
||||||
|
(db/index/get-filename database index-name object)))
|
||||||
|
|
||||||
|
(defun db/index/new (database index-name object file-name)
|
||||||
(let ((symlink-path
|
(let ((symlink-path
|
||||||
(concatenate 'string
|
(db/index/get-symlink-path database index-name object)))
|
||||||
(db-path database)
|
|
||||||
"/by_" index-name "/"
|
|
||||||
(db/index/get-filename database index-name object))))
|
|
||||||
|
|
||||||
; Works even when the database directory is moved.
|
; Works even when the database directory is moved.
|
||||||
(osicat:make-link symlink-path
|
(osicat:make-link symlink-path
|
||||||
|
@ -68,15 +71,24 @@
|
||||||
:hard nil)
|
:hard nil)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
; Example: 000000000000018.data
|
||||||
|
(defun db/add/new-data-filename (database)
|
||||||
|
(format nil "~15,'0D.data" (db-current-index database)))
|
||||||
|
|
||||||
|
; Example: {db-path}/data/000000000000018.data
|
||||||
|
(defun db/add/new-data-filepath (database file-name)
|
||||||
|
(concatenate 'string (db-path database) "/data/" file-name))
|
||||||
|
|
||||||
(defun db/add (database object)
|
(defun db/add (database object)
|
||||||
(incf (db-current-index database))
|
(incf (db-current-index database))
|
||||||
(let ((file-name (format nil "~15,'0D.data" (db-current-index database))))
|
(let ((file-name (db/add/new-data-filename database)))
|
||||||
(util:write-object-to-file object (concatenate 'string
|
(util:write-object-to-file
|
||||||
(db-path database) "/data/" file-name))
|
object
|
||||||
|
(db/add/new-data-filepath database file-name))
|
||||||
|
|
||||||
; TODO: handle indexes
|
; TODO: handle indexes
|
||||||
(loop for index in (db-indexes database)
|
(loop for index in (db-indexes database)
|
||||||
do (db/add/new-link database index object file-name))
|
do (db/index/new database index object file-name))
|
||||||
|
|
||||||
; TODO: handle partitions
|
; TODO: handle partitions
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue