rename package msglog to msgstore

This commit is contained in:
Helmut Merz 2024-07-30 17:29:06 +02:00
parent 428952598f
commit 1ac8eb6482
5 changed files with 21 additions and 14 deletions

View file

@ -8,7 +8,7 @@
:description "Generic data processing."
:depends-on (:scopes-core :scopes-web
:dbi :sxql)
:components ((:file "storage/msglog" :depends-on ("storage/tracking"))
:components ((:file "storage/msgstore" :depends-on ("storage/tracking"))
(:file "storage/storage")
(:file "storage/tracking" :depends-on ("storage/storage")))
:long-description "scopes: generic data processing facilities."

View file

@ -1,6 +1,6 @@
;;;; cl-scopes/storage/msglog - storing message data in a SQL database
;;;; cl-scopes/storage/msgstore - storing message data in a SQL database
(defpackage :scopes/storage/msglog
(defpackage :scopes/storage/msgstore
(:use :common-lisp)
(:local-nicknames (:message :scopes/core/message)
(:shape :scopes/shape)
@ -8,7 +8,7 @@
(:tracking :scopes/storage/tracking))
(:export #:make-container #:save))
(in-package :scopes/storage/msglog)
(in-package :scopes/storage/msgstore)
(defclass pmsg (message:message tracking:track) ())

View file

@ -62,6 +62,7 @@
(t:show-result))))
(deftest test-util ()
(== (util:rtrim '(1 2 nil 3 nil)) '(1 2))
(== (util:to-keyword "hello-kitty") :hello-kitty)
(== (util:loop-plist '(:a "a" :b "b") k v collect (string-upcase k)) '("A" "B")))

View file

@ -8,7 +8,7 @@
(:core :scopes/core)
(:logging :scopes/logging)
(:message :scopes/core/message)
(:msglog :scopes/storage/msglog)
(:msgstore :scopes/storage/msgstore)
(:shape :scopes/shape)
(:storage :scopes/storage)
(:tracking :scopes/storage/tracking)
@ -37,7 +37,7 @@
(core:setup-services)
(let ((ctx (core:find-service :storage)))
(test-track ctx)
(test-msglog ctx)
(test-msgstore ctx)
(t:show-result)))
(deftest test-track (ctx)
@ -58,15 +58,15 @@
(== (getf (shape:data tr2) :desc) "scopes/storage: queries")
))
(deftest test-msglog (ctx)
(deftest test-msgstore (ctx)
(let ((st (storage:storage ctx))
(data (make-hash-table))
cont msg pm pm2)
(setf cont (msglog:make-container st))
(setf cont (msgstore:make-container st))
(storage:drop-table st :messages)
(tracking:create-table cont)
(setf msg (message:create '(:test :data :field) :data '(:info "test data")))
(setf pm (msglog:save msg cont))
(setf pm (msgstore:save msg cont))
(== (tracking:trackid pm) 1)
(setf pm2 (tracking:get-track cont 1))
;(log:info "pm2: ~s" pm2)

View file

@ -2,13 +2,22 @@
(defpackage :scopes/util
(:use :common-lisp)
(:export #:flatten-str #:to-keyword #:keyword-to-string #:to-string
#:loop-plist
(:export #:rtrim #:loop-plist
#:flatten-str #:to-keyword #:keyword-to-string #:to-string
#:absolute-dir #:check-dir #:ensure-dir #:home-path #:path-from-string
#:relative-path #:runtime-path #:system-path))
(in-package :scopes/util)
;;;; lists and loops
(defun rtrim (lst)
(if (car lst)
(cons (car lst) (rtrim (cdr lst)))))
(defmacro loop-plist (plist kvar vvar &body body)
`(loop for (,kvar ,vvar . nil) on ,plist by #'cddr ,@body))
;;;; strings, symbols, keywords, ...
(defun flatten-str (s &key (sep " "))
@ -30,9 +39,6 @@
nil
(intern (string-upcase s) :keyword)))
(defmacro loop-plist (plist kvar vvar &body body)
`(loop for (,kvar ,vvar . nil) on ,plist by #'cddr ,@body))
;;;; directory and pathname utilities
(defun split-filename (name)