aboutsummaryrefslogtreecommitdiffhomepage
path: root/vampire.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-10-22 08:27:26 -0500
committerColin Okay <colin@cicadas.surf>2022-10-22 08:27:26 -0500
commit03029efd07ad5273818e585a9b94472dbfcc06e6 (patch)
tree41456b12629c289a077c061e9cfbb0dafe576cf8 /vampire.lisp
parentdf8df584beb6f79cc2659b027e87bebbb45d5bba (diff)
Add: Resource model and some utilities
Diffstat (limited to 'vampire.lisp')
-rw-r--r--vampire.lisp55
1 files changed, 55 insertions, 0 deletions
diff --git a/vampire.lisp b/vampire.lisp
index f6d5d20..7ad9b63 100644
--- a/vampire.lisp
+++ b/vampire.lisp
@@ -1,3 +1,58 @@
;;;; vampire.lisp
(in-package #:vampire)
+
+;;; SYSTEM CONFIG COMPONENT
+
+(defvar *config* nil)
+
+(defclass/std config ()
+ ((datastore-directory :ir
+ :std #P"/srv/parasite/store/")
+ (port :ir
+ :std 4919)
+ (media-directory :ir
+ :std #P"/srv/parasite/media/")))
+
+;;; RESOURCE MODEL
+
+(defclass/bknr keyed ()
+ ((key
+ :r :std (nuid)
+ :index-type string-unique-index
+ :index-reader object-with-key)))
+
+(defclass/bknr content (keyed)
+ ((title :with :std "")
+ (user :with
+ :ri
+ :std (error "A USER is required to have created the content.")
+ :index-type hash-index
+ :index-reader content-by-user)))
+
+(defmethod initialize-instance :after ((content content) &key)
+ (when (zerop (length (content-title content)))
+ (setf (content-title content) (format nil "~a-~a"
+ (class-of content)
+ (store-object-id content)))))
+
+(defclass/bknr playlist (content)
+ ((tracks editors :with :std (list))))
+
+(defclass/bknr track (content)
+ ((source media artist album :with)
+ (playlists :with :std (list) :doc "Playlists in which this track appears.")
+ (status :a :with
+ :std :uninitialized
+ :doc ":uninitialized, :acquiring, :available, :error-aquiring")))
+
+(defclass/bknr user (keyed)
+ ((name :with :std "")
+ (pw pwhash :with )
+ (playlists :with :std (list) :doc "Playlists made by this user")))
+
+(defclass/std media (bknr.datastore:blob)
+ ((track :with))
+ (:metaclass persistent-class))
+
+;;; RESOURCE ACCESS PROTOCOL