Commit fda3b369 authored by David Kågedal's avatar David Kågedal
Browse files

Började implementera prefetch av text-listor, men det är inte klart.

parent 689eb335
...@@ -307,26 +307,26 @@ prefetched the prefetch is not done." ...@@ -307,26 +307,26 @@ prefetched the prefetch is not done."
;; (lyskom-stack-push lyskom-prefetch-stack (list 'CONF-TEXTS text-list)))) ;; (lyskom-stack-push lyskom-prefetch-stack (list 'CONF-TEXTS text-list))))
;; (lyskom-continue-prefetch)) ;; (lyskom-continue-prefetch))
(defun lyskom-prefetch-text-list (text-list &optional queue) (defun lyskom-prefetch-texts (texts &optional queue)
"Prefetches a list of texts." "Prefetches a list of texts."
(if (text-list->empty text-list) (if (null texts)
nil nil
(if queue (if queue
(lyskom-queue-enter queue (lyskom-queue-enter queue
(list 'TEXT-LIST (text-list->texts text-list))) (list 'TEXTS texts))
(lyskom-stack-push lyskom-prefetch-stack (lyskom-stack-push lyskom-prefetch-stack
(list 'TEXT-LIST (text-list->texts text-list))))) (list 'TEXTS texts))))
(lyskom-continue-prefetch)) (lyskom-continue-prefetch))
(defun lyskom-prefetch-text-list-continue (texts &optional queue) ;; (defun lyskom-prefetch-text-list-continue (texts &optional queue)
"Prefetches a list of texts." ;; "Prefetches a list of texts."
(if (null texts) ;; (if (null texts)
nil ;; nil
(if queue ;; (if queue
(lyskom-queue-enter queue (list 'TEXT-LIST-CONT texts)) ;; (lyskom-queue-enter queue (list 'TEXT-LIST-CONT texts))
(lyskom-stack-push lyskom-prefetch-stack ;; (lyskom-stack-push lyskom-prefetch-stack
(list 'TEXT-LIST-CONT texts)))) ;; (list 'TEXT-LIST-CONT texts))))
(lyskom-continue-prefetch)) ;; (lyskom-continue-prefetch))
;;; ================================================================ ;;; ================================================================
...@@ -414,7 +414,7 @@ Return t if an element was prefetched, otherwise return nil." ...@@ -414,7 +414,7 @@ Return t if an element was prefetched, otherwise return nil."
;; A simple request? ;; A simple request?
((and (listp element) ((and (listp element)
(memq (car element) (memq (car element)
'(CONFSTAT PERSSTAT TEXTSTAT TEXTMASS TEXT-LIST-CONT))) '(CONFSTAT PERSSTAT TEXTSTAT TEXTMASS)))
(setcar prefetch-list 'DONE) (setcar prefetch-list 'DONE)
(lyskom-prefetch-one-request element nil) (lyskom-prefetch-one-request element nil)
(setq result t)) (setq result t))
...@@ -424,7 +424,7 @@ Return t if an element was prefetched, otherwise return nil." ...@@ -424,7 +424,7 @@ Return t if an element was prefetched, otherwise return nil."
(memq (car element) (memq (car element)
'(TEXTAUTH TEXT-ALL TEXTTREE '(TEXTAUTH TEXT-ALL TEXTTREE
CONFSTATFORMAP MAP MARKS CONFSTATFORMAP MAP MARKS
MEMBERSHIP WHOBUFFER TEXT-LIST))) MEMBERSHIP WHOBUFFER TEXTS)))
(let ((queue (lyskom-queue-create))) (let ((queue (lyskom-queue-create)))
(setcar prefetch-list queue) (setcar prefetch-list queue)
(lyskom-prefetch-one-request element queue) (lyskom-prefetch-one-request element queue)
...@@ -522,8 +522,8 @@ Return t if an element was prefetched, otherwise return nil." ...@@ -522,8 +522,8 @@ Return t if an element was prefetched, otherwise return nil."
(initiate-get-marks 'prefetch 'lyskom-prefetch-marks-handler queue)) (initiate-get-marks 'prefetch 'lyskom-prefetch-marks-handler queue))
((eq (car request) 'WHOBUFFER) ((eq (car request) 'WHOBUFFER)
(initiate-who-is-on 'prefetch 'lyskom-prefetch-whobuffer-handler queue)) (initiate-who-is-on 'prefetch 'lyskom-prefetch-whobuffer-handler queue))
((or (eq (car request) 'TEXT-LIST) (eq (car request) 'TEXT-LIST-CONT)) ((eq (car request) 'TEXTS)
(initiate-get-text-stat 'prefetch 'lyskom-prefetch-text-list-handler (initiate-get-text-stat 'prefetch 'lyskom-prefetch-texts-handler
(car (nth 1 request)) (car (nth 1 request))
(cdr (nth 1 request)) (cdr (nth 1 request))
queue)) queue))
...@@ -686,7 +686,7 @@ Maps are `cached' in lyskom-to-do-list." ...@@ -686,7 +686,7 @@ Maps are `cached' in lyskom-to-do-list."
(-- lyskom-pending-prefetch) (-- lyskom-pending-prefetch)
) )
(defun lyskom-prefetch-text-list-handler (text-stat texts queue) (defun lyskom-prefetch-texts-handler (text-stat texts queue)
"Prefetch all info neccessary to write the text with text-stat TEXT-STAT. "Prefetch all info neccessary to write the text with text-stat TEXT-STAT.
Put the requests on QUEUE." Put the requests on QUEUE."
(lyskom-stop-prefetch) (lyskom-stop-prefetch)
...@@ -709,9 +709,9 @@ Put the requests on QUEUE." ...@@ -709,9 +709,9 @@ Put the requests on QUEUE."
((eq type 'FOOTN-TO) ((eq type 'FOOTN-TO)
(lyskom-prefetch-textauth (misc-info->footn-to misc) queue)) (lyskom-prefetch-textauth (misc-info->footn-to misc) queue))
(t nil)))) (t nil))))
(if (null texts) (lyskom-queue-enter queue 'FINISHED)
(and queue (lyskom-queue-enter queue 'FINISHED)) ;; The queue is now used up.
(lyskom-prefetch-text-list-continue texts queue)) (lyskom-prefetch-texts texts)
(-- lyskom-pending-prefetch) (-- lyskom-pending-prefetch)
(lyskom-start-prefetch)) (lyskom-start-prefetch))
......
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