Project

Profile

Help

Story #3693

Updated by bmbouter over 5 years ago

h2. Motivation 

 Pulp3 users would greatly benefit from the "lazy" feature capabilities that Pulp2 RPM users enjoy. Unfortunately that support was specific to Pulp2 RPM. In Pulp2 we are motivated to introduce this feature and do it in a way that placel minimal requirements on plugin writers. 


 h2. Usage 

 The user can specify to use "lazy" when syncing any given Remote by setting the <code>policy</code> attribute on the Remote. The default <code>policy</code> is "immediate", so to use lazy this option must be specified explicitly. Lazy behavior is not the default because not all plugins can support it, but all plugins can support "immediate". 

 Here are the modes of lazy operation: 

 <pre> 
 policy=immediate    -> downloads now while the task runs (no lazy). Also the default if unspecified. 
 policy=on_demand     -> All the steps in the diagram. Content that is downloaded is saved so that it's only ever downloaded once. 
 policy=cache_only       -> All the steps in the diagram except step 14. If squid pushes the bits out of the cache, it will be re-downloaded again to serve to other clients requesting the same bits. 
 </pre> 

 A plugin must specifically add "lazy support", so verify that a plugin supports the lazy feature set. 


 h2. Plugin Involvement 

 To add "lazy support" to any given Pulp3 plugin, there are a few things a plugin writer must do. 

 1. Add/Remove <code>RemoteArtifact</code> as needed to reflect the artifacts in the remote repository. 
 2. Check the Remote.policy attribute. If 'immediate' do the normal thing. If 'cache_only' or 'on_demand' continue to step 3. 
 3. For each <code>Artifact</code> object, instead of downloading and saving it locally, save the equivalent    <code>RemoteArtifact</code> instead and associate that with the <code>ContentArtifact</code> object. 

 Once supported, plugin writer's will be able to use both <code>cache_only</code> and <code>on_demand</code> options. 


 h2. Design 

 See the call sequence diagram below: 

 !lazy_diagram_v4.png! !lazy_diagram_v3.png! 


 ^ diagram built by "this image builder page":http://www.plantuml.com/plantuml/uml/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000 using "this gist data":https://gist.github.com/bmbouter/f9e7ed5b03efd5e52cf29ba78f3b25c1.

Back