Okay here's the database we actually need

parent 99493619
......@@ -271,29 +271,15 @@
;;; Database stuff
;;; ==============
(define/contract (db-set! collection key val)
(-> symbol? symbol? any/c void?)
(hash-set! (hash-ref (db) collection) key val)
(define/contract (db-append! collection val)
(-> symbol? any/c void?)
(hash-set! (db) collection
(cons val (hash-ref (db) collection '())))
(define/contract (db-init-collection! collection)
(-> symbol? void?)
(when (hash-has-key? (db) collection)
(error "Collection already exists!"))
(hash-set! (db) collection (make-hasheq))
(define/contract (db-ref collection key)
(-> symbol? symbol? any/c)
(hash-ref (hash-ref (db) collection) key))
(define/contract (db-has-key? collection key)
(-> symbol? symbol? boolean?)
(hash-has-key? (hash-ref (db) collection) key))
(define (init-db!)
(db-init-collection! 'inbox)
(db-init-collection! 'outbox))
(define/contract (db-ref collection)
(-> symbol? pair?) ;; technically list? but that's expensive :)
(hash-ref (db) collection))
;;; Application launching
;;; =====================
......@@ -309,7 +295,6 @@
[db (make-hasheq)]
[magenc-store magenc-store_]
[base-url base-url_])
(serve/servlet golem-dispatch
#:servlet-regexp #rx""
#:launch-browser? #f
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment