New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Package cache #915
Package cache #915
Conversation
class RepositoryStorage implements StorageInterface | ||
{ | ||
private static $loader; | ||
private static $dumper; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why making them static ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because they are used in static method convertPackage(). Why is this method static? Don't know :) It was more clear for me to have such util method as static with cached dumper and loader.
You write to cache at DownloadManager and read from it from RepositoryManager. |
@palex-fpt Actually it is not a simple cache in one place when you try to replace some havy operation with simple one. It consits of 2 concepts: copy all packages to the dedicated repository (like some proxy), use fast local repository for packages. This concepst can be used separately. You can cache evrething but not enable the system repository. Or you can use system repository with no auto-cache. |
Oh, I got the point. Your repack packages to local distribution. |
@palex-fpt For now it compresses targetDir content as is (without targetDir itself in the archive). |
What append to this issue? Package cache will be great for continuous integration when you have to rebuilt everything at each commit to run you test... |
I will update this PR on weekend with some improvements for defaults and separation of the system repository and cache. |
…e() and add test for hasPackage
Rebased and improved. Description was updated. |
@chEbba maybe I missed something but it seems to me like this is overly complex. We already have a Cache class that could be integrated in the downloaders with very few changes instead of adding a gazillion new lines of code to maintain. In particular, I fail to see the benefits of repackaging and of the split between repository and cache functionalities. What's the use case with only using one of those (repository & cache)? Furthermore, the fact that you cache packages with a higher priority means that for dev packages you will get stale data instead of getting the newest from packagist. |
See #1282 for what I mean by lighter approach. It works just as well and with a few more lines will have GC of items not used in more than X. It probably could use one more option to completely disable it, but you get the idea. I'm open for discussion but unless this adds great benefits over the other PR, I would rather have less code to maintain. |
Sorry for late answer. Yes it is not so simple, like file cache. When i started with this problem i understand that there are 2 ways of solving it in the current architecture:
Then I remembered about another package manager concept - local repository (which i called system, as we already have one local in Composer). This repository is useful for development, CI, etc. when you don't need to create any remote repositry (ex. maven local repository). So i will save this branch for future, if system storage concept will be interesting for Composer. |
Ok I see a bit better, but with my file cache the dist format does not matter either, it just stores it so the actual download step can be skipped later. I agree it might be useful to have a concept of local repo, but then again you can already set a "composer" repository to a local filesystem path I believe (and if not, it wouldn't be a huge change), so I would rather reuse that than adding a lot of new code. |
@chEbba was the goal to provide a general means to support a feature like |
Related: http://git-scm.com/docs/git-clone |
@patcon I don't think this would help much, but that's interesting though, maybe we should do all clones to a central location and then reference the repo like that if it already exists. Only problem would be to do reference counting somehow to avoid using space for repos that aren't used anywhere on disk anymore. If you'd like to create a new issue for this I'd be happy to discuss it further. It would mean much faster clones which would be pretty cool. |
@patcon I think this feature can be implemented on CvsDownloader level. We used such feature in one of our deploy system where we had a local storage with git repositories (we didn't use alternates just clone from local one, but i thnik alternates is better solution). It really reduces build time. If you create a new issue please link it here. I'm interested in this discussion. |
Reviewed system package cache from #62.
How it works:
Options:
Notes:
Planned improvements:
Discussion: