Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/multiplexer/filter/id_filter.py
# Copyright (C) 2015-2017 The Software Heritage developers | # Copyright (C) 2015-2017 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 | ||||
import re | import re | ||||
import abc | import abc | ||||
from swh.model import hashutil | from swh.model import hashutil | ||||
from .filter import ObjStorageFilter | from swh.objstorage.multiplexer.filter.filter import ObjStorageFilter | ||||
from ...objstorage import compute_hash | from swh.objstorage.objstorage import compute_hash | ||||
from ...exc import ObjNotFoundError | from swh.objstorage.exc import ObjNotFoundError | ||||
class IdObjStorageFilter(ObjStorageFilter, metaclass=abc.ABCMeta): | class IdObjStorageFilter(ObjStorageFilter, metaclass=abc.ABCMeta): | ||||
""" Filter that only allow operations if the object id match a requirement. | """ Filter that only allow operations if the object id match a requirement. | ||||
Even for read operations, check before if the id match the requirements. | Even for read operations, check before if the id match the requirements. | ||||
This may prevent for unnecessary disk access. | This may prevent for unnecessary disk access. | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |