Package flumotion :: Package component :: Package misc :: Package httpserver :: Package httpcached :: Module strategy_base :: Class CachingSession
[hide private]

Class CachingSession

source code

             object --+    
                      |    
     BaseCachingSession --+
                          |
extern.log.log.Loggable --+
                          |
                         CachingSession

Caches a stream locally in a temporary file. The already cached data can be read from the session.

Can be canceled, meaning the session is not valid anymore.

Can be aborted, meaning the session will stop caching locally but is still valid.

The caching operation can be started at any moment, but the session have to receive the stream info before it can be used with a RemoteSource instance.

It can recover request failures up to MAX_RESUME_COUNT times.

Instance Methods [hide private]
 
__init__(self, strategy, url, cache_stats, ifModifiedSince=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
isActive(self) source code
 
getState(self) source code
 
cache(self)
Starts caching the remote resource locally.
source code
 
waitInfo(self) source code
 
waitStarted(self) source code
 
waitFinished(self) source code
 
read(self, offset, size) source code
 
cancel(self)
After calling this method the session cannot be used anymore.
source code
 
abort(self)
After calling this method the session will just stop caching and return None when trying to read.
source code
 
addref(self) source code
 
delref(self) source code
 
isref(self) source code
 
serverError(self, getter, code, message) source code
 
conditionFail(self, getter, code, message) source code
 
streamNotAvailable(self, getter, code, message) source code
 
onInfo(self, getter, info) source code
 
_gotTempFile(self, tempFile) source code
 
onData(self, getter, data) source code
 
streamDone(self, getter) source code
 
_error(self, error) source code
 
_fireInfo(self, value) source code
 
_fireStarted(self, value) source code
 
_fireFinished(self, value) source code
 
_fireError(self, error) source code
 
_close(self) source code
 
_complete(self) source code
 
_real_complete(self) source code
 
_firstRetrieve(self) source code
 
_resumeRetrieve(self, offset, size) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Inherited from extern.log.log.Loggable: __providedBy__, __provides__, debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]
  logCategory = 'caching-session'
Implementors can provide a category to log their messages under.
  mimetypes = ourmimetypes.MimeTypes()
  ABORTED = 8
  BUFFERING = 2
hash(x)
  CACHED = 4
  CACHING = 3
  CANCELED = 7
  CLOSED = 6
  DETACHED = 5
  ERROR = 9
  PIPELINING = 0
  REQUESTING = 1
hash(x)

Inherited from BaseCachingSession: mimeType, mtime, size, strategy, url

Inherited from extern.log.log.Loggable: __implemented__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, strategy, url, cache_stats, ifModifiedSince=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

read(self, offset, size)

source code 
Overrides: BaseCachingSession.read

cancel(self)

source code 

After calling this method the session cannot be used anymore.

Overrides: BaseCachingSession.cancel

abort(self)

source code 

After calling this method the session will just stop caching and return None when trying to read. Used when pipelining is wanted.

addref(self)

source code 
Overrides: BaseCachingSession.addref

delref(self)

source code 
Overrides: BaseCachingSession.delref