Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/cache.py
Show All 9 Lines | |||||
class VaultCache: | class VaultCache: | ||||
"""The Vault cache is an object storage that stores Vault bundles. | """The Vault cache is an object storage that stores Vault bundles. | ||||
This implementation computes sha1('<bundle_type>:<object_id>') as the | This implementation computes sha1('<bundle_type>:<object_id>') as the | ||||
internal identifiers used in the underlying objstorage. | internal identifiers used in the underlying objstorage. | ||||
""" | """ | ||||
def __init__(self, objstorage): | def __init__(self, **objstorage): | ||||
self.objstorage = get_objstorage(**objstorage) | self.objstorage = get_objstorage(**objstorage) | ||||
def add(self, obj_type, obj_id, content): | def add(self, obj_type, obj_id, content): | ||||
sid = self._get_internal_id(obj_type, obj_id) | sid = self._get_internal_id(obj_type, obj_id) | ||||
return self.objstorage.add(content, sid) | return self.objstorage.add(content, sid) | ||||
def get(self, obj_type, obj_id): | def get(self, obj_type, obj_id): | ||||
sid = self._get_internal_id(obj_type, obj_id) | sid = self._get_internal_id(obj_type, obj_id) | ||||
Show All 21 Lines |