Naming convention.
parent
fe41a86eb8
commit
774e9bd436
26
src/dodb.cl
26
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)
|
||||||
(let ((symlink-path
|
|
||||||
(concatenate 'string
|
(concatenate 'string
|
||||||
(db-path database)
|
(db-path database)
|
||||||
"/by_" index-name "/"
|
"/by_" index-name "/"
|
||||||
(db/index/get-filename database index-name object))))
|
(db/index/get-filename database index-name object)))
|
||||||
|
|
||||||
|
(defun db/index/new (database index-name object file-name)
|
||||||
|
(let ((symlink-path
|
||||||
|
(db/index/get-symlink-path 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