Cache::RequiredFetcherImplementation Class Reference

#include <CacheEngine.hpp>

Inheritance diagram for Cache::RequiredFetcherImplementation:

UZI::DocumentFetcher List of all members.

Detailed Description

This class declare the interface for a document fetcher.

Every time the cache miss a document, it will call one of the method from this interface. Implementation is left to the browser part. Every method should be re-entrant (for thread safety). It's implementation role to ensure thread safeness in case it uses threads.

In case of fetching error, the fetcher must set the item status to corresponding error.

An application must implement this callback in order to use the holder

See also:
Holder


Public Member Functions

virtual uint32 isItemFetched (volatile Item &item) const =0
 Check if all data for a previously queued item has been received.
virtual bool queueDocumentToFetch (volatile Item &item, void *opaque=0)=0
 Add a document to fetch, as soon as possible, to the query list.


Member Function Documentation

virtual uint32 Cache::RequiredFetcherImplementation::isItemFetched ( volatile Item item  )  const [pure virtual]

Check if all data for a previously queued item has been received.

The holder will call this method to check if an item is fully available, or is being fetched. It's the fetcher role to return the state of the fetching.

Warning:
This call must not block. This means that if the fetcher is multithreaded, it must not lock the item lock entirely while fetching it, as this call will most probably requires locking it too, to check if it's there.
If the fetcher is single threaded, then this method could return a boolean state (0 or item's size), and the item data should be set in an atomic way (and in a specific order => type first, then data, then size, then deleter if required)

Parameters:
item A reference on an item to check reception
Returns:
the fetched size (or -1 if not fetched yet, or single threaded). The holder use this size to estimate the remaining time to wait.

virtual bool Cache::RequiredFetcherImplementation::queueDocumentToFetch ( volatile Item item,
void *  opaque = 0 
) [pure virtual]

Add a document to fetch, as soon as possible, to the query list.

The holder will call this method when the cache item is missed (either item's lifetime expired, or on not found event). It's possible to queue the fetching on a thread pool. The cache will then wait until a signal is sent to it, and returns the fetched item's data on success.

Parameters:
item A reference on an item to fetch as soon as possible
opaque An opaque object that could be used to pass any structure from the cache to the fetcher
Returns:
true if it's possible to fetch it, even if done later on, false on error (like network error)


The documentation for this class was generated from the following file:

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is