| Home | Trees | Index | Help |
|
|---|
|
|
DiscoCacheFetcherBaseBase class for cache object fetchers -- classes responsible for retrieving objects from network.
An instance of a fetcher class is created for each object requested and
not found in the cache, then fetch method is called to initialize
the asynchronous retrieval process. Fetcher object's got_it method
should be called on a successfull retrieval and error otherwise.
timeout will be called when the request timeouts.
| Method Summary | |
|---|---|
Initialize an CacheFetcher object. | |
Handle a retrieval error and call apriopriate handler. | |
Start the retrieval process. | |
Handle a successfull retrieval and call apriopriate handler. | |
Handle fetcher timeout and call apriopriate handler. | |
Remove the fetcher from cache and mark it not active. | |
Mark the fetcher inactive after it is removed from the cache. | |
bool |
Check if a backup item is available in cache and call the item handler if it is. |
| Instance Variable Summary | |
|---|---|
bool |
active: True as long as the fetcher is active and requestor
expects one of the handlers to be called. |
| any hashable | address: requested item address. |
Cache |
cache: cache object which created this fetcher. |
datetime |
timeout_time: timeout time. |
| Method Details |
|---|
__init__(self,
cache,
address,
item_freshness_period,
item_expiration_period,
item_purge_period,
object_handler,
error_handler,
timeout_handler,
timeout_period,
backup_state=None)
Initialize an |
error(self, error_data)Handle a retrieval error and call apriopriate handler. Should be called when retrieval fails. Do nothing when the fetcher is not active any more (after one of handlers was already called).
|
fetch(self)Start the retrieval process. This method must be implemented in any fetcher class. |
got_it(self, value, state='new')Handle a successfull retrieval and call apriopriate handler. Should be called when retrieval succeeds. Do nothing when the fetcher is not active any more (after one of handlers was already called).
|
timeout(self)Handle fetcher timeout and call apriopriate handler. Is called by the cache object and should _not_ be called by fetcher or application. Do nothing when the fetcher is not active any more (after one of handlers was already called). |
_deactivate(self)Remove the fetcher from cache and mark it not active. |
_deactivated(self)Mark the fetcher inactive after it is removed from the cache. |
_try_backup_item(self)Check if a backup item is available in cache and call the item handler if it is.
|
| Instance Variable Details |
|---|
activeTrue as long as the fetcher is active and requestor
expects one of the handlers to be called.
|
addressrequested item address.
|
cachecache object which created this fetcher.
|
timeout_timetimeout time.
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Mon Dec 26 17:57:33 2005 | http://epydoc.sf.net |