Skip to content
Snippets Groups Projects
Commit 2bf2d3f5 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

Migrate from swh.core.hashutil to swh.model.hashutil

Related T700
parent f1b3199a
No related branches found
No related tags found
No related merge requests found
swh.core >= 0.0.28
swh.model >= 0.0.13
swh.model >= 0.0.14
swh.objstorage >= 0.0.17
swh.scheduler >= 0.0.11
......@@ -3,7 +3,7 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from swh.core import hashutil
from swh.model import hashutil
from swh.core.api import SWHRemoteAPI
from swh.storage.exc import StorageAPIError
......
# Copyright (C) 2016 The Software Heritage developers
# Copyright (C) 2016-2017 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from swh.scheduler.task import Task
from swh.core import hashutil
from swh.model import hashutil
from ..cache import VaultCache
from ..cookers import COOKER_TYPES
from ... import get_storage
......@@ -23,4 +23,4 @@ class SWHCookingTask(Task):
# Initialize cooker
cooker = COOKER_TYPES[type](storage, cache)
# Perform the cooking
cooker.cook(obj_id=hashutil.hex_to_hash(hex_id))
cooker.cook(obj_id=hashutil.hash_to_bytes(hex_id))
# Copyright (C) 2016 The Software Heritage developers
# Copyright (C) 2016-2017 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import os
from swh.core import hashutil
from swh.model import hashutil
from swh.objstorage import get_objstorage
from swh.objstorage.objstorage_pathslicing import DIR_MODE
......@@ -29,11 +29,11 @@ class VaultCache():
def get(self, obj_type, obj_id):
storage = self._get_storage(obj_type)
return storage.get(hashutil.hex_to_hash(obj_id))
return storage.get(hashutil.hash_to_bytes(obj_id))
def is_cached(self, obj_type, obj_id):
storage = self._get_storage(obj_type)
return hashutil.hex_to_hash(obj_id) in storage
return hashutil.hash_to_bytes(obj_id) in storage
def ls(self, obj_type):
storage = self._get_storage(obj_type)
......
# Copyright (C) 2016 The Software Heritage developers
# Copyright (C) 2016-2017 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
......@@ -13,7 +13,7 @@ import tempfile
from pathlib import Path
from swh.core import hashutil
from swh.model import hashutil
def get_tar_bytes(path, arcname=None):
......
# Copyright (C) 2016 The Software Heritage developers
# Copyright (C) 2016-2017 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
......@@ -6,7 +6,7 @@
import tempfile
from pathlib import Path
from swh.core import hashutil
from swh.model import hashutil
from .base import BaseVaultCooker, DirectoryBuilder, get_tar_bytes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment