Package conary :: Package lib :: Module util :: Class LazyFileCache
[hide private]
[frames] | no frames]

Class LazyFileCache

source code

An object tracking open files. It will serve file-like objects that get closed behind the scene (and reopened on demand) if the number of open files in the current process exceeds a threshold. The objects will close automatically when they fall out of scope.

Instance Methods [hide private]
 
__init__(self, threshold=None)
PUBLIC API
source code
 
open(self, path, mode='r')
PUBLIC API
source code
 
_getFdCount(self) source code
 
_getCounter(self) source code
 
_getSlot(self) source code
 
_closeSlot(self, fd) source code
 
close(self)
PUBLIC API
source code
 
release(self)
Release the file descriptors kept open by the LazyFile objects
source code
 
__del__(self)
PUBLIC API
source code
Class Variables [hide private]
  threshold = 900
Method Details [hide private]

__init__(self, threshold=None)
(Constructor)

source code 
PUBLIC API
Decorators:
  • @api.publicApi

open(self, path, mode='r')

source code 
PUBLIC API
Decorators:
  • @api.publicApi
Raises:
  • IOError - raised if there's an I/O error opening the fd
  • OSError - raised on other errors opening the fd

close(self)

source code 
PUBLIC API
Decorators:
  • @api.publicApi
Raises:
  • IOError - could be raised if tell() fails prior to close()

__del__(self)
(Destructor)

source code 
PUBLIC API
Decorators:
  • @api.publicApi
Raises:
  • IOError - could be raised if tell() fails prior to close()