1812
class _GCBuildDetails(object):
1813
"""A blob of data about the build details.
1815
This stores the minimal data, which then allows compatibility with the old
1816
api, without taking as much memory.
1819
__slots__ = ('_index', '_group_start', '_group_end', '_basis_end',
1820
'_delta_end', '_parents')
1823
compression_parent = None
1825
def __init__(self, parents, position_info):
1826
self._parents = parents
1827
self._index = position_info[0]
1828
self._group_start = position_info[1]
1829
# Is this _end or length? Doesn't really matter to us
1830
self._group_end = position_info[2]
1831
self._basis_end = position_info[3]
1832
self._delta_end = position_info[4]
1835
return '%s(%s, %s)' % (self.__class__.__name__,
1836
self.index_memo, self._parents)
1839
def index_memo(self):
1840
return (self._index, self._group_start, self._group_end,
1841
self._basis_end, self._delta_end)
1844
def record_details(self):
1845
return static_tuple.StaticTuple(self.method, None)
1847
def __getitem__(self, offset):
1848
"""Compatibility thunk to act like a tuple."""
1850
return self.index_memo
1852
return self.compression_parent # Always None
1854
return self._parents
1856
return self.record_details
1858
raise IndexError('offset out of range')
1812
1864
class _GCGraphIndex(object):
1813
1865
"""Mapper from GroupCompressVersionedFiles needs into GraphIndex storage."""
2011
2063
parents = entry[3][0]
2013
result[key] = (self._node_to_position(entry),
2014
None, parents, (method, None))
2064
details = _GCBuildDetails(parents, self._node_to_position(entry))
2065
result[key] = details
2017
2068
def keys(self):
2033
2084
# each, or about 7MB. Note that it might be even more when you consider
2034
2085
# how PyInt is allocated in separate slabs. And you can't return a slab
2035
2086
# to the OS if even 1 int on it is in use. Note though that Python uses
2036
# a LIFO when re-using PyInt slots, which probably causes more
2087
# a LIFO when re-using PyInt slots, which might cause more
2037
2088
# fragmentation.
2038
2089
start = int(bits[0])
2039
2090
start = self._int_cache.setdefault(start, start)