This is a list of array(‘H’)
of
devices ids. The outermost list contains an
array(‘H’)
for each replica. Each
array(‘H’)
has a length equal to
the partition count for the ring. Each integer in the
array(‘H’)
is an index into the
above list of devices. The partition list is known
internally to the Ring class as
_replica2part2dev_id
.
So, to create a list of device dictionaries assigned to a partition, the Python code would look like:
devices = [self.devs[part2dev_id[partition]] for part2dev_id in self._replica2part2dev_id]
That code is a little simplistic because it does not account for the removal of duplicate devices. If a ring has more replicas than devices, a partition will have more than one replica on a device.
array(‘H’)
is used for memory
conservation as there may be millions of
partitions.