Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | class Storage: | ||||
def _content_add(self, contents, with_data): | def _content_add(self, contents, with_data): | ||||
content_with_data = [] | content_with_data = [] | ||||
content_without_data = [] | content_without_data = [] | ||||
for content in contents: | for content in contents: | ||||
if content.status is None: | if content.status is None: | ||||
content.status = 'visible' | content.status = 'visible' | ||||
if content.length is None: | if content.length is None: | ||||
content.length = -1 | content.length = -1 | ||||
if content.status == 'visible': | if content.status != 'absent': | ||||
if self._content_key(content) not in self._contents: | if self._content_key(content) not in self._contents: | ||||
content_with_data.append(content) | content_with_data.append(content) | ||||
elif content.status == 'absent': | else: | ||||
if self._content_key(content) not in self._skipped_contents: | if self._content_key(content) not in self._skipped_contents: | ||||
content_without_data.append(content) | content_without_data.append(content) | ||||
if self.journal_writer: | if self.journal_writer: | ||||
for content in content_with_data: | for content in content_with_data: | ||||
content = attr.evolve(content, data=None) | content = attr.evolve(content, data=None) | ||||
self.journal_writer.write_addition('content', content) | self.journal_writer.write_addition('content', content) | ||||
for content in content_without_data: | for content in content_without_data: | ||||
▲ Show 20 Lines • Show All 1,653 Lines • Show Last 20 Lines |