Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/model.py
# Copyright (C) 2020 The Software Heritage developers | # Copyright (C) 2020-2022 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
"""Classes used internally by the in-memory idx-storage, and will be | """Classes used internally by the in-memory idx-storage, and will be | ||||
used for the interface of the idx-storage in the near future.""" | used for the interface of the idx-storage in the near future.""" | ||||
from __future__ import annotations | from __future__ import annotations | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
class ContentLanguageRow(BaseRow): | class ContentLanguageRow(BaseRow): | ||||
object_type: Final = "content_language" | object_type: Final = "content_language" | ||||
id = attr.ib(type=Sha1Git) | id = attr.ib(type=Sha1Git) | ||||
lang = attr.ib(type=str) | lang = attr.ib(type=str) | ||||
@attr.s | @attr.s | ||||
class ContentCtagsRow(BaseRow): | |||||
object_type: Final = "content_ctags" | |||||
UNIQUE_KEY_FIELDS = ( | |||||
"id", | |||||
"indexer_configuration_id", | |||||
"name", | |||||
"kind", | |||||
"line", | |||||
"lang", | |||||
) | |||||
id = attr.ib(type=Sha1Git) | |||||
name = attr.ib(type=str) | |||||
kind = attr.ib(type=str) | |||||
line = attr.ib(type=int) | |||||
lang = attr.ib(type=str) | |||||
@attr.s | |||||
class ContentLicenseRow(BaseRow): | class ContentLicenseRow(BaseRow): | ||||
object_type: Final = "content_fossology_license" | object_type: Final = "content_fossology_license" | ||||
UNIQUE_KEY_FIELDS = ("id", "indexer_configuration_id", "license") | UNIQUE_KEY_FIELDS = ("id", "indexer_configuration_id", "license") | ||||
id = attr.ib(type=Sha1Git) | id = attr.ib(type=Sha1Git) | ||||
license = attr.ib(type=str) | license = attr.ib(type=str) | ||||
Show All 37 Lines |