Re: Getting only latest X messages of a newsgroup

Cedric Hyppolite <[email protected]> Wed, 2 Aug 2006 19:57:07 +0200
Newsgroups gmane.comp.java.classpath.extensions.discuss
Message-ID <[email protected]>
Le 1 ao=C3=BBt 06 =C3=A0 09:36, Chris Burdess a =C3=A9crit :

> [email protected] 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 =20
>>>> 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 =20=

>>> 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 =20
>>> 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 =20=

>> folder' does
>> not return all folders by default...
>
> Yes; I can't say I was very happy about having to do that either =20
> 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 =20
> articles 450-500 and the latest article range (from the group =20
> command) is 460-550. On getMessages, we would mark all the cached =20
> articles as not RECENT, do an xhdr for the range 501-550 and mark =20
> any newly retrieved articles as RECENT (note that it might not =20
> retrieve any new articles at all because of cancellations). We =20
> would then return all the messages from 460-550 from getMessages, =20
> and their flag state would indicate which of them had been =20
> retrieved as part of the call.
>
> Note that the xhdr only retrieves a list of Message-IDs from the =20
> server, so it really shouldn't take all that long even for large =20
> numbers of articles assuming the server supports xhdr (if not it =20
> really is inefficient).

This would mark as RECENT the articles received in the last call to =20
getMessages(). But the feature I was talking about is to restrict the =20=

actual number of messages asked through xhdr. Let's say you want to =20
retrieve only the last 10 articles.
 =46rom the example you gave, it would do an xhdr on 541-550 only, mark =20=

them as recent, and unmark the cached articles as recent.

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

C=C3=A9dric


> --=20
> =E7=8A=AC Chris Burdess
>   "They that can give up essential liberty to obtain a little safety
>   deserve neither liberty nor safety." - Benjamin Franklin
>
>
>
>