Skip to content

Commit

Permalink
De-duplication of onedata objectstore code.
Browse files Browse the repository at this point in the history
Use caching abstractions and bring in line with other object stores.
  • Loading branch information
jmchilton committed May 19, 2024
1 parent 9d2a45f commit 11c7c3d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 315 deletions.
5 changes: 4 additions & 1 deletion lib/galaxy/objectstore/_caching_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,14 @@ def _empty(self, obj, **kwargs):
else:
raise ObjectNotFound(f"objectstore.empty, object does not exist: {obj}, kwargs: {kwargs}")

def _get_size_in_cache(self, rel_path):
return os.path.getsize(self._get_cache_path(rel_path))

def _size(self, obj, **kwargs):
rel_path = self._construct_path(obj, **kwargs)
if self._in_cache(rel_path):
try:
return os.path.getsize(self._get_cache_path(rel_path))
return self._get_size_in_cache(rel_path)
except OSError as ex:
log.info("Could not get size of file '%s' in local cache, will try Azure. Error: %s", rel_path, ex)
elif self._exists_remotely(rel_path):
Expand Down
Loading

0 comments on commit 11c7c3d

Please sign in to comment.