ceylon / ceylon-module-resolver

DEPRECATED
Apache License 2.0
23 stars 9 forks source link

Make `ArtifactCallback` work for puts to remote repositories #123

Open quintesse opened 9 years ago

quintesse commented 9 years ago

Right now the ArtifactCallback is only called when downloading something from a remote repository and ignored when uploading to it.

Although there might be a different way to solve this, because I'd also like for the callback to be used for local operations, so that for example a copy operation from one local repo to another would also use the callback.

That way the progress report for uploading would automatically work because it would really be showing the progress of the read operations of the local repository.

Thing is all those operations go through AbstractNodeRepositoryManager.addContent() and not through RootRepositoryManager.putContent() where the callback is being handled and I'm not sure what the best way is to handle this. Wdyt @alesj ?

alesj commented 9 years ago

@quintesse Let me check out the code ... after 1M years ...

alesj commented 9 years ago

@quintesse afais, AbstractNodeRepositoryManager.addContent() has it's only impl in RootRepositoryManager. And that impl always calls RootRepositoryManager::putContent().

quintesse commented 9 years ago

@alesj as you can read from the log.debug() statement you put at the beginning of that method (RootRepositoryManager::putContent()) it only gets called when "Creating local copy of external node", in other words: only when downloading.

quintesse commented 9 years ago

And after some more debugging I can tell you that when uploading the RootRepositoryManager isn't even used! It's the CachingRepositoryManager that does all the work, putArtifact() in line 99 which delegates to AbstractNodeRepositoryManager.putArtifact() in the line 254 which then goes to putArtifactInternal() which uses OpenNode::addContent() to actually upload the artifact.

alesj commented 9 years ago

@quintesse ok, I must admit I don't follow all the details. I would say, adjust the callback code as you please.

When I added it, I tried to find the right download place, I didn't put upload into consideration.

quintesse commented 9 years ago

Well it was not so much that I was asking for permission but for help because I'm not sure at all how to do it ;) But I'll just see what I can break ;)