From fee73c9f8ed2213d22df12f2a407639764079d60 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sat, 15 Oct 2022 11:28:16 -0500 Subject: Add: app-dict --- lazybones.lisp | 14 +++++++++++++- package.lisp | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lazybones.lisp b/lazybones.lisp index 5bdd7e6..d15af33 100644 --- a/lazybones.lisp +++ b/lazybones.lisp @@ -105,7 +105,11 @@ :documentation "Default content type sent back to clients.") (endpoints :accessor app-endpoints - :initform nil))) + :initform nil) + (dict + :accessor app-dict + :initform (make-hash-table :test 'equal) + :documentation "A hash table for storing arbitrary informatrion on this application."))) (defun expand-provision-app-option (app option value) (list 'setf @@ -144,6 +148,14 @@ supplied, get the default app. Every package has at most one default app, named with the package name. If no app can be found, return NIL" (symbol-lazybones (or name (default-app-name)) nil)) +(defun app-dict (key &optional name) + "Get value from the application dict" + (gethash key (app-dict (app name)))) + +(defun (setf app-dict) (new key &optional name) + "Set a value in the application dict." + (setf (gethash key (app-dict (app name))) new)) + (defclass endpoint () ((method :reader endpoint-method diff --git a/package.lisp b/package.lisp index 6e57492..8c65afd 100644 --- a/package.lisp +++ b/package.lisp @@ -81,5 +81,6 @@ #:set-definition #:drop-definition #:add-class-to-definitions - #:ext->mimetype)) + #:ext->mimetype + #:app-dict)) -- cgit v1.2.3