|
From: | Chris Burdess |
Subject: | Re: [Classpathx-discuss] Getting only latest X messages of a newsgroup |
Date: | Tue, 1 Aug 2006 08:36:51 +0100 |
address@hidden wrote:
I see two ways: - Get at most X latest articles: fetching the message headers using (last - X) or first -> last as the range in NNTPFolder.getMessages() - Get exactly the X latest articles: fetching the message headers using first -> last and keeping only the latest X messages Either way, the internal cache is used to prevent queries for previously downloaded messages. Once the getMessages() returned the array of X recent messages, their full content can be downloaded using fetch(Message[], FetchProfile) There would be one property (for example 'mail.nntp.limittolatest' ) that states the number of messages to download at most or exactly. This property should be read each time before being used so that a client could change the value before fetching each newsgroup.I kind of see where you're going with this, but doesn't it change the semantics of getMessages? Wouldn't it be better just to concentrate on optimising the range passed to xhdr, and instead manage themessages' RECENT flags to indicate which ones were new in the last call?I'm not sure at all about returning fewer messages than are actually present.This is a behaviour changed by properties similar to the way 'list folder' doesnot return all folders by default...
Yes; I can't say I was very happy about having to do that either but at least there is a directly corresponding NNTP artifact.
Can you explain a little bit how you see the recent flag operation ?
Say we have already performed a getMessages which retrieved articles 450-500 and the latest article range (from the group command) is 460-550. On getMessages, we would mark all the cached articles as not RECENT, do an xhdr for the range 501-550 and mark any newly retrieved articles as RECENT (note that it might not retrieve any new articles at all because of cancellations). We would then return all the messages from 460-550 from getMessages, and their flag state would indicate which of them had been retrieved as part of the call.
Note that the xhdr only retrieves a list of Message-IDs from the server, so it really shouldn't take all that long even for large numbers of articles assuming the server supports xhdr (if not it really is inefficient).
-- 犬 Chris Burdess "They that can give up essential liberty to obtain a little safety deserve neither liberty nor safety." - Benjamin Franklin
[Prev in Thread] | Current Thread | [Next in Thread] |