Skip to content

Commit

Permalink
Rename args to sampledata/db-path
Browse files Browse the repository at this point in the history
  • Loading branch information
BonfaceKilz committed Jan 6, 2023
1 parent 6197f93 commit e2d702e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dump.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,20 @@ columns, with DATA. Return the hash."
key-hash-prefix
(sampledata-db-get db (hash-vector-ref versions-hash-vector i))))
(hash-vector-length versions-hash-vector))))))

(defun import-into-sampledata-db (data db-path)
"Import MATRIX which is a sampledata-matrix object into
DB-PATH."
(with-sampledata-db (db db-path :write t)
(let* ((hash (sampledata-db-matrix-put db data))
(db-matrix (sampledata-db-matrix db hash)))
;; Read written data back and verify.
(unless (and (all (lambda (i)
(equalp (matrix-row (sampledata-matrix sampledata) i)
(equalp (matrix-row (sampledata-matrix data) i)
(sampledata-db-matrix-row-ref db-matrix i)))
(iota (sampledata-db-matrix-nrows db-matrix)))
(all (lambda (i)
(equalp (matrix-column (sampledata-matrix sampledata) i)
(equalp (matrix-column (sampledata-matrix data) i)
(sampledata-db-matrix-column-ref db-matrix i)))
(iota (sampledata-db-matrix-ncols db-matrix))))
;; Roll back database updates.
Expand Down

0 comments on commit e2d702e

Please sign in to comment.