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

(lyskom-prefetch-all-confs): Gör lyskom-wait-for-membership.

(lyskom-wait-for-membership): Skriv ut det totala antalet möten också.
parent 5f7a8e06
......@@ -1860,126 +1860,19 @@ If optional argument NOCHANGE is non-nil then the list wont be altered."
(defun lyskom-wait-for-membership ()
"If the full membership hase been read do nothing. Else give a message and
wait for it to be prefetched."
(while (not (eq lyskom-membership-is-read t))
(lyskom-message (lyskom-get-string 'waiting-for-membership)
lyskom-membership-is-read)
(lyskom-accept-process-output)))
(let ((total (pers-stat->no-of-confs (blocking-do 'get-pers-stat
lyskom-pers-no))))
(while (not (lyskom-membership-is-read))
(lyskom-message (lyskom-get-string 'waiting-for-membership)
lyskom-membership-is-read
total)
(lyskom-accept-process-output))))
(defun lyskom-prefetch-all-confs ()
"Gets all conferences using prefetch."
;; (while (numberp lyskom-membership-is-read)
;; (accept-process-output nil lyskom-apo-timeout-s lyskom-apo-timeout-ms))
)
;; ---------------------------------------------------------
;; prefetch conf-stats
;; (defun lyskom-prefetch-conf ()
;; "Fetch conf-stats for next few conferences from lyskom-membership.
;; This is the main prefetch things function.
;;
;; This is initiated by lyskom-refetch.
;;
;; The following variables and functions are involved:
;; lyskom-last-conf-fetched, lyskom-last-conf-received, lyskom-last-conf-done
;; \(this functions variables).
;; lyskom-membership, lyskom-unread-confs (set at login).
;; Functions:
;; lyskom-prefetch-conf, starts the ball going, later verifies that everything
;; is done.
;; lyskom-prefetch-handle-conf, starts the ball for a conf.
;;
;; Idea:
;; This functions fetches one conf from lyskom-unread-confs, creates an empty
;; read-list entry and fires away a lyskom-prefetch-handle-conf. The
;; lyskom-prefetch-handle-conf fills the read-list entry with articles to be
;; read. When all articles are fetched then lyskom-prefetch-handle-conf
;; will increase lyskom-last-conf-done and call lyskom-prefetch-conf that fetches
;; the next conf.
;;
;; If we start reading before everything is fetched then two things will happen.
;; For every thing we do (every prompt we get) there will be another
;; lyskom-prefetch-conf started and possibly another thread of
;; lyskom-prefetch-handle-conf. This will not be a problem.
;;
;; List news and other things that require the correct count of articles will
;; have to wait. The correct way of waiting is to use lyskom-prefetch-all-confs.
;;
;; If we just want to know wether we have fetched all info or not we do the test
;; \(lyskom-prefetch-done)."
;;
;; ;; Algoritm:
;; ;;
;;
;; (let ((lyskom-prefetch-confs lyskom-prefetch-confs))
;; (while (and (< lyskom-last-conf-fetched
;; (lyskom-membership-highest-index))
;; (< (- lyskom-last-conf-fetched lyskom-last-conf-received)
;; lyskom-prefetch-confs))
;; (++ lyskom-last-conf-fetched)
;; (let ((membership (elt lyskom-membership lyskom-last-conf-fetched)))
;; (if (lyskom-conf-no-list-member (membership->conf-no membership)
;; lyskom-unread-confs)
;; (initiate-get-conf-stat 'main 'lyskom-prefetch-handle-conf
;; (membership->conf-no membership)
;; membership)
;; (++ lyskom-last-conf-done)
;; (++ lyskom-prefetch-confs)
;; (++ lyskom-last-conf-received))))))
;; (defun lyskom-prefetch-done ()
;; "Returns t if lyskom has fetched all its info."
;; (>= lyskom-last-conf-done
;; (lyskom-membership-highest-index)))
;; (defun lyskom-prefetch-handle-conf (conf-stat membership)
;; "Check if there is any unread texts in a conference.
;; Args: CONF-STAT MEMBERSHIP"
;; (++ lyskom-last-conf-received)
;; (cond
;; ((and (lyskom-visible-membership membership)
;; (> (+ (conf-stat->first-local-no conf-stat)
;; (conf-stat->no-of-texts conf-stat)
;; -1)
;; (membership->last-text-read membership)))
;; ;; There are (probably) some unread texts in this conf.
;; ;; (initiate-get-map 'prefetch nil ;; 'lyskom-prefetch-handle-map
;; (initiate-get-map 'prefetch nil 'lyskom-prefetch-handle-map
;; (conf-stat->conf-no conf-stat)
;; (1+ (membership->last-text-read membership))
;; (+ (conf-stat->no-of-texts conf-stat)
;; (conf-stat->first-local-no conf-stat)
;; (- (membership->last-text-read membership)))
;; membership
;; conf-stat))
;; (t
;; ;; Consider this conference handled
;; (++ lyskom-last-conf-done)
;; (lyskom-prefetch-and-print-prompt))))
;; (defun lyskom-prefetch-handle-map (map membership conf-stat)
;; "Add info about unread texts in a conf to the lyskom-to-do-list.
;; Args: MAP MEMBERSHIP CONF-STAT.
;; MAP is the mapping from local to global text-nos for (at least) all
;; texts after membership->last-text-read. MEMBERSHIP is info about the
;; user's membership in the conference."
;; (++ lyskom-last-conf-done)
;; (let ((unread (lyskom-list-unread map membership)))
;; (cond
;; (unread
;; (read-list-enter-read-info
;; (lyskom-create-read-info
;; 'CONF
;; conf-stat
;; (membership->priority membership)
;; (lyskom-create-text-list unread))
;; lyskom-to-do-list))))
;; (lyskom-prefetch-and-print-prompt))
(lyskom-wait-for-membership))
;; (defun lyskom-list-unread (map membership)
......@@ -2036,6 +1929,12 @@ The list consists of text-nos."
(-- i)
;; The server always send the read texts in sorted order. This
;; means that we can use binary search to look for read texts.
;; It might be a good idea to check for zero, and not do a
;; sarch in that case, but it depends on how big holes there
;; are in the map. In general the extra test is probably a
;; slowdow, but when reading the initial part of the I]M map
;; it would most likely help a lot.
(when (lyskom-binsearch (+ i first) read)
(aset the-map i 0))))
(delq 0 (listify-vector the-map))))
......@@ -2055,75 +1954,6 @@ The list consists of text-nos."
;; result))
;;-------------------------------------------------------
;; prefetch text-stats
;; (defun lyskom-prefetch-text ()
;; "Make sure that at least lyskom-prefetch-texts texts are fetched."
;; (lyskom-prefetch-from-rlist
;; (lyskom-prefetch-from-rlist lyskom-prefetch-texts
;; (read-list->all-entries lyskom-reading-list))
;; (read-list->all-entries lyskom-to-do-list)))
;; (defun lyskom-prefetch-from-rlist (n-texts rlist)
;; "Prefetch first N-TEXTS texts from RLIST.
;; Returns number of texts that could not be fetched.
;; RLIST is a list of reading-info."
;; (cond
;; ((< n-texts 1)
;; 0)
;; ((null rlist)
;; n-texts)
;; (t
;; (lyskom-prefetch-from-rlist
;; (lyskom-prefetch-from-list
;; n-texts
;; (cdr (read-info->text-list (car rlist))))
;; (cdr rlist)))))
;; (defun lyskom-prefetch-from-list (n-texts list)
;; "Prefetch first N-TEXTS texts from LIST.
;; Returns number of texts that could not be fetched.
;; RLIST is a list of text-nos. Texts whose text-no is present on
;; lyskom-fetched-texts are not fetched."
;; (while (and (not (null list)) (> n-texts 0))
;; ;; Fetch this text - but only if we are not already fetching it.
;; (if (memq (car list) lyskom-fetched-texts)
;; nil ;already fetched (but maybe not yet
;; ;received).
;; (initiate-get-text-stat 'prefetch 'lyskom-prefetch-comment-stats
;; (car list))
;; (initiate-get-text 'prefetch nil (car list))
;; (setq lyskom-fetched-texts (cons (car list) lyskom-fetched-texts)))
;; (setq list (cdr list))
;; (-- n-texts))
;; n-texts)
;; (defun lyskom-prefetch-comment-stats (text-stat)
;; "Prefetch the text-stats of the comments to this text."
;; (let ((misc (text-stat->misc-info-list text-stat)))
;; (while misc
;; (cond ((eq 'COMM-IN (misc-info->type (car misc)))
;; (initiate-get-text-stat 'prefetch nil
;; (misc-info->comm-in (car misc))))
;; ((eq 'FOOTN-IN (misc-info->type (car misc)))
;; (initiate-get-text-stat 'prefetch nil
;; (misc-info->footn-in (car misc))))
;; ((eq 'COMM-TO (misc-info->type (car misc)))
;; (initiate-get-text-stat 'prefetch nil
;; (misc-info->comm-to (car misc))))
;; ((eq 'FOOTN-TO (misc-info->type (car misc)))
;; (initiate-get-text-stat 'prefetch nil
;; (misc-info->footn-to (car misc))))
;; ((or (eq 'RCPT (misc-info->type (car misc)))
;; (eq 'CC-RCPT (misc-info->type (car misc))))
;; (initiate-get-conf-stat 'prefetch nil
;; (misc-info->recipient-no (car misc))))
;; (t nil))
;; (setq misc (cdr misc)))))
;;;; ================================================================
......
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