| 864 | return self._chunks |
| 865 | |
| 866 | def seen_chunk(self, id, size=None): |
| 867 | entry = self.chunks.get(id) |
| 868 | entry_exists = entry is not None |
| 869 | if entry_exists and size is not None: |
| 870 | if entry.size == 0: |
| 871 | # AdHocWithFilesCache: |
| 872 | # Here *size* is used to update the chunk's size information, which will be zero for existing chunks. |
| 873 | self.chunks[id] = entry._replace(size=size) |
| 874 | else: |
| 875 | # in case we already have a size information in the entry, check consistency: |
| 876 | assert size == entry.size |
| 877 | return entry_exists |
| 878 | |
| 879 | def reuse_chunk(self, id, size, stats): |
| 880 | assert isinstance(size, int) and size > 0 |