MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / proxy

Method proxy

aura/cache.py:282–303  ·  view source on GitHub ↗
(cls, *, src: Path)

Source from the content-addressed store, hash-verified

280
281 @classmethod
282 def proxy(cls, *, src: Path) -> Path:
283 if cls.get_location() is None: # Caching is disabled
284 return src
285
286 cache_obj = MirrorJSON(src=src)
287
288 if cache_obj.is_valid:
289 logger.debug(f"Retrieving package mirror JSON {cache_obj.cid} from cache")
290 return cache_obj.cache_file_location
291
292 # If the mirror is a mounted network drive (common configuration), this would trigger a network traffic/calls
293 # We want to prevent any network traffic for performance reasons if possible,
294 # so we check if the path exists AFTER we check for the cache entry, e.g. `cache_obj.is_valid`
295 if not src.exists():
296 return src
297
298 try:
299 cache_obj.fetch(src=src)
300 return cache_obj.cache_file_location
301 except Exception as exc:
302 cache_obj.delete()
303 raise exc
304
305 @property
306 def metadata(self) -> dict:

Callers

nothing calls this directly

Calls 5

fetchMethod · 0.95
MirrorJSONClass · 0.85
get_locationMethod · 0.80
existsMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected