classpathx-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpathx-discuss] Getting only latest X messages of a newsgroup


From: Cedric Hyppolite
Subject: Re: [Classpathx-discuss] Getting only latest X messages of a newsgroup
Date: Wed, 2 Aug 2006 19:57:07 +0200


Le 1 août 06 à 09:36, Chris Burdess a écrit :

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 the
messages' 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' does
not 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).

This would mark as RECENT the articles received in the last call to getMessages(). But the feature I was talking about is to restrict the actual number of messages asked through xhdr. Let's say you want to retrieve only the last 10 articles. From the example you gave, it would do an xhdr on 541-550 only, mark them as recent, and unmark the cached articles as recent.

I think we are talking about two different features with probably related implementations.

Cédric


--
犬 Chris Burdess
  "They that can give up essential liberty to obtain a little safety
  deserve neither liberty nor safety." - Benjamin Franklin









reply via email to

[Prev in Thread] Current Thread [Next in Thread]