Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/storage.py
Show All 31 Lines | from swh.model.model import ( | ||||
Content, | Content, | ||||
Directory, | Directory, | ||||
Origin, | Origin, | ||||
OriginVisit, | OriginVisit, | ||||
OriginVisitStatus, | OriginVisitStatus, | ||||
Revision, | Revision, | ||||
Release, | Release, | ||||
SkippedContent, | SkippedContent, | ||||
Sha1, | |||||
Sha1Git, | Sha1Git, | ||||
Snapshot, | Snapshot, | ||||
SHA1_SIZE, | SHA1_SIZE, | ||||
MetadataAuthority, | MetadataAuthority, | ||||
MetadataAuthorityType, | MetadataAuthorityType, | ||||
MetadataFetcher, | MetadataFetcher, | ||||
MetadataTargetType, | MetadataTargetType, | ||||
RawExtrinsicMetadata, | RawExtrinsicMetadata, | ||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | def content_add_metadata(self, content: List[Content], db=None, cur=None) -> Dict: | ||||
self.journal_writer.content_add_metadata(contents) | self.journal_writer.content_add_metadata(contents) | ||||
self._content_add_metadata(db, cur, contents) | self._content_add_metadata(db, cur, contents) | ||||
return { | return { | ||||
"content:add": len(contents), | "content:add": len(contents), | ||||
} | } | ||||
@timed | @timed | ||||
def content_get( | def content_get_data(self, content: Sha1) -> Optional[bytes]: | ||||
self, contents: List[bytes] | # FIXME: Make this method support slicing the `data` | ||||
) -> Iterable[Optional[Dict[str, bytes]]]: | return self.objstorage.content_get(content) | ||||
# FIXME: Make this method support slicing the `data`. | |||||
vlorentz: same | |||||
if len(contents) > BULK_BLOCK_CONTENT_LEN_MAX: | |||||
raise StorageArgumentException( | |||||
f"Send at maximum {BULK_BLOCK_CONTENT_LEN_MAX} contents." | |||||
) | |||||
yield from self.objstorage.content_get(contents) | |||||
@timed | @timed | ||||
@db_transaction() | @db_transaction() | ||||
def content_get_partition( | def content_get_partition( | ||||
self, | self, | ||||
partition_id: int, | partition_id: int, | ||||
nb_partitions: int, | nb_partitions: int, | ||||
page_token: Optional[str] = None, | page_token: Optional[str] = None, | ||||
▲ Show 20 Lines • Show All 1,148 Lines • Show Last 20 Lines |
same