Skip to content
Snippets Groups Projects
Commit 8ac000b4 authored by vlorentz's avatar vlorentz
Browse files

cache: Don't return objstorage.add's return value, and add types

objstorage.add() will change/remove its return value in a future version,
and we do not use it in the vault anyway.
parent 6436f0bb
No related branches found
Tags v1.7.0
1 merge request!153cache: Don't return objstorage.add's return value, and add types
......@@ -19,11 +19,11 @@ class VaultCache:
def __init__(self, **objstorage):
self.objstorage = get_objstorage(**objstorage)
def add(self, bundle_type, swhid: CoreSWHID, content):
def add(self, bundle_type, swhid: CoreSWHID, content) -> None:
sid = self._get_internal_id(bundle_type, swhid)
return self.objstorage.add(content, sid)
self.objstorage.add(content, sid)
def get(self, bundle_type, swhid: CoreSWHID):
def get(self, bundle_type, swhid: CoreSWHID) -> bytes:
sid = self._get_internal_id(bundle_type, swhid)
return self.objstorage.get(hashutil.hash_to_bytes(sid))
......@@ -31,7 +31,7 @@ class VaultCache:
sid = self._get_internal_id(bundle_type, swhid)
return self.objstorage.delete(hashutil.hash_to_bytes(sid))
def is_cached(self, bundle_type, swhid: CoreSWHID):
def is_cached(self, bundle_type, swhid: CoreSWHID) -> bool:
sid = self._get_internal_id(bundle_type, swhid)
return hashutil.hash_to_bytes(sid) in self.objstorage
......
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