RepoManager#
- class mobu.services.repo.RepoManager(logger, *, testing=False)#
Bases:
objectA reference-counting caching repo cloner.
Only the first call to
clonefor a given repo url and ref will clone the repo. Subsequent calls will return the location and hash of the already-cloned repo.A call to
invalidatewill make it so that the next call toclonewill re-clone the repo to a different path.A call to
clonealso increases a reference counter for the url + ref + hash combo of the cloned repo. A call toinvalidatefor that combo decreases the counter.Invalidatewill only delete the files from the cloned repo if the reference count drops to 0.- Parameters:
logger (
BoundLogger) – A loggertesting (
bool, default:False)
Methods Summary
clone(url, ref, username)Clone a git repo or return cached info by url + ref.
close()Delete all cloned repos and containing directory.
invalidate(url, ref, repo_hash, username)Invalidate a git repo in the cache by url + ref.
Methods Documentation
- async clone(url, ref, username)#
Clone a git repo or return cached info by url + ref.
Increase the reference count for the url + ref + hash combo.
- Parameters:
- Return type:
- async invalidate(url, ref, repo_hash, username)#
Invalidate a git repo in the cache by url + ref.
Decrease the url + ref + hash reference count. If it drops to zero, delete the files from that clone.