More comments!

parent 96722ded
......@@ -370,6 +370,11 @@
;;; Message-sending/receiving workers
;;; =================================
;; Federate out message to all recipients.
;; We split out federating to each recipient into a separate thread
;; so each can happen asynchronously.
;; We need to retrieve each actor's inbox from their actor profile
;; before we can POST to them.
(define/contract (federate-message message recipients)
(-> bytes? (listof url?) any/c)
;; TODO: get recipients even in case they are objects rather than just uris
......@@ -385,6 +390,8 @@
'("Content-Type: application/activity+json")))))
(void))
;; Process an incoming message.
;; Spawns a separate thread, so this doesn't block the caller.
(define (process-federated-message message)
(thread
(lambda ()
......@@ -405,12 +412,17 @@
;;; Database stuff
;;; ==============
;; The "database" is simply a mutable hashtable where keys are
;; symbols and values are lists of items.
;; Append VAL to COLLECTION in the global db
(define/contract (db-append! collection val)
(-> symbol? any/c void?)
(hash-set! (db) collection
(cons val (hash-ref (db) collection '())))
(void))
;; Fetch all items from COLLECTION in the global DB
(define/contract (db-ref collection)
(-> symbol? (or/c pair? null?)) ; technically list? but that's pricey :)
(hash-ref (db) collection '()))
......@@ -418,6 +430,7 @@
;;; Store stuff
;;; ===========
;; Handy utility for pulling json out of a magenc store
(define (store-get-json url [store (magenc-store)])
(define json-str
(call-with-output-string
......@@ -432,6 +445,7 @@
;;; Application launching
;;; =====================
;; TODO: This could be simplified if we just set the parameters
(define (main #:users-name users-name_
#:magenc-store [magenc-store_
(new memory-store%)]
......
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