Project

Profile

Help

Story #3209

Updated by dkliban@redhat.com almost 7 years ago

h2. Motivation 

 The ContentUnits added to a repository change over time, but Pulp only stores the current state. This prevents a lot of great things like rolling back to a particluar snapshot, or understanding exactly what content is in place at any given time. 

 h2. Solution 

 Introducing the Repository Version, which represents the ContentUnits in a repository after any given operation. For example, each of the following operations will produce a repository version. 

 * Sync from an importer 
 * Add a set of units to a repository 
 * Remove a set of units from a repository 

 Any repository version can be deleted. Publications are changed to publish a specific RepositoryVersion, not just the latest content in a given repo. 

 h2. API examples 

 <pre> 
 POST /api/v3/repositories/{repo_id}/versions/    # create the new RepositoryVersion. specify the importer here, and/or units to add, and/or units to remove 
 GET /api/v3/repository/{repo_id}/versions/{number}    # The resource for a single repo version 
 GET /api/v3/repositories/{repo_id}/versions/<id>/content/    # paginated list of all content in particular version 
 GET /api/v3/repositories/{repo_id}/versions/<id>/added_content/    # paginated list of content added when a particular version was created 
 GET /api/v3/repositories/{repo_id}/versions/<id>/removed_content/    # paginated list of content removed when a particular version was created 
 </pre> 

 h2. Technical details 

 The _RepositoryVersion_ table stores all repository versions for all repositories. A repository version is a set of content. 

 *RepositoryVersion* 
 * [pk] *id* - The primary key. 
 * [fk] *content* - The associated repository. 
 * *created* - When the repository version was created. 
 * *number* - A positive integer that uniquely identifies a version of a specific repository. Each new version for a repository should have this field set to 1 + the most recent version. 

 The _RepositoryContent_ table stores association between a repository version and its contained content.  

 content 

 *RepositoryContent* 
 * [pk] *id* - The primary key. 
 * [fk] *content* - The associated content. 
 * [fk] *repository* - The associated repository. 
 * [fk] *version_added* - The RepositoryVersion which added the referenced Content. 
 * [fk] *version_removed* - The RepositoryVersion which removed the referenced Content. 

Back