Package _emerge :: Module BlockerCache :: Class BlockerCache
[hide private]

Class BlockerCache

source code

                       object --+        
                                |        
   portage.cache.mappings.Mapping --+    
                                    |    
portage.cache.mappings.MutableMapping --+
                                        |
                                       BlockerCache

This caches blockers of installed packages so that dep_check does not
have to be done for every single installed package on every invocation of
emerge.  The cache is invalidated whenever it is detected that something
has changed that might alter the results of dep_check() calls:
        1) the set of installed packages (including COUNTER) has changed

Nested Classes [hide private]
  BlockerData
Instance Methods [hide private]
 
__init__(self, myroot, vardb)
myroot is ignored in favour of EROOT
source code
 
_load(self) source code
 
flush(self)
If the current user has permission and the internal blocker cache been updated, save it to disk and mark it unmodified.
source code
 
__setitem__(self, cpv, blocker_data)
Update the cache and mark it as modified for a future call to self.flush().
source code
 
__iter__(self) source code
 
__len__(self)
This needs to be implemented in order to avoid infinite recursion in some cases.
source code
 
__delitem__(self, cpv) source code
BlockerData
__getitem__(self, cpv)
Returns: An object with counter and atoms attributes.
source code

Inherited from portage.cache.mappings.MutableMapping: clear, pop, popitem, setdefault, update

Inherited from portage.cache.mappings.Mapping: __contains__, __repr__, get, items, iteritems, iterkeys, itervalues, keys, values

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

Class Variables [hide private]
  _cache_threshold = 5
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, myroot, vardb)
(Constructor)

source code 

myroot is ignored in favour of EROOT

Overrides: object.__init__

flush(self)

source code 
If the current user has permission and the internal blocker cache
been updated, save it to disk and mark it unmodified.  This is called
by emerge after it has proccessed blockers for all installed packages.
Currently, the cache is only written if the user has superuser
privileges (since that's required to obtain a lock), but all users
have read access and benefit from faster blocker lookups (as long as
the entire cache is still valid).  The cache is stored as a pickled
dict object with the following format:

{
        version : "1",
        "blockers" : {cpv1:(counter,(atom1, atom2...)), cpv2...},
}

__setitem__(self, cpv, blocker_data)
(Index assignment operator)

source code 

Update the cache and mark it as modified for a future call to self.flush().

Parameters:
  • cpv (String) - Package for which to cache blockers.
  • blocker_data (BlockerData) - An object with counter and atoms attributes.

__iter__(self)

source code 
Overrides: portage.cache.mappings.Mapping.__iter__

__len__(self)
(Length operator)

source code 

This needs to be implemented in order to avoid infinite recursion in some cases.

Overrides: portage.cache.mappings.Mapping.__len__

__getitem__(self, cpv)
(Indexing operator)

source code 
Returns: BlockerData
An object with counter and atoms attributes.