Package flumotion :: Package component :: Package misc :: Package httpserver :: Module cachedprovider :: Class CopySession
[hide private]

Class CopySession

source code

extern.log.log.Loggable --+
                          |
                         CopySession

I'm serving a file at the same time I'm copying it from the network file system to the cache. If the client ask for data not yet copied, the source file read operation is delegated the the copy thread as an asynchronous operation because file seeking/reading is not thread safe.

The copy session have to open two times the temporary file, one for read-only and one for write only, because closing a read/write file change the modification time. We want the modification time to be set to a known value when the copy is finished even keeping read access to the file.

The session manage a reference counter to know how many TempFileDelegate instances are using the session to delegate read operations. This is done for two reasons:

Instance Methods [hide private]
 
__init__(self, plug, sourcePath, sourceFile, sourceInfo) source code
 
outdate(self) source code
 
read(self, position, size, stats) source code
 
incRef(self) source code
 
decRef(self) source code
 
_close(self) source code
 
close(self) source code
 
doServe(self) source code
 
doCopy(self) source code
 
_allocCacheSpace(self) source code
 
_releaseCacheSpace(self) source code
 
_cancelSession(self) source code
 
_gotCacheSpace(self, tag) source code
 
_startCopying(self) source code
 
_cancelCopy(self, closeSource, closeTempWrite) source code
 
_onCopyCancelled(self, closeSource, closeTempWrite) source code
 
_onCopyFinished(self) source code
 
_removeTempFile(self) source code
 
_closeSourceFile(self) source code
 
_closeReadTempFile(self) source code
 
_closeWriteTempFile(self) source code

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

Class Variables [hide private]
  logCategory = 'fileprovider-localcached'
Implementors can provide a category to log their messages under.

Inherited from extern.log.log.Loggable: __implemented__