Closed Moliholy closed 8 years ago
One general remark:
I think the Repository
class now finally gets out of hand by being able to switch between revisions. That makes it actually quite stateful in a sense that the following could become confusing:
import cvmfs
repo = cvmfs.open_repository("http://cvmfs-stratum-one.cern.ch/cvmfs/atlas.cern.ch")
repo.switch_revision(1337) # very old revision
# 200 more python lines here
dirent = repo.lookup_path("/a/funny/cutting/edge/entry")
# dirent not found... wut?
I sense that it would be better to have a class encapsulating a single catalog tree revision like:
repo = ...
catalogs_1337 = repo.open_revision(1337)
catalogs_yesterday = repo.open_tag("yesterday")
catalogs_cutting_edge = repo.open_latest() # based on .cvmfspublished root hash
catalogs_***.lookup("/a/funny/cutting/edge/entry")
Hence Repository::open_***()
would return a CatalogManager
that is based on a specific root hash which cannot be altered. Opening a new revisions means instantiating a new CatalogManager
in that model. Of course there is one major caveat: Catalogs might show up in multiple CatalogManagers
.
This is just jotting down thoughts. Let's think about how to do that in a concise way.
In that case, shall this PR be approved and those changes you are mentioning added to a new one? I have already made the rest of the changes.
Let's do it in a separate Pull Request to keep things simple.
After making the browser stable here I have a few modifications for the library.