Project

General

Profile

Feature #4823

Updated by Tim Pierce over 9 years ago

For more consistent and uniform manifest handling, we should provide an SDK that applications can use to build and manipulate manifest files. 

 This proposal is to implement the following methods, either directly on a Collection or on a Manifest class as it seems appropriate: (possibly under arvados.collection) 

 Exposed methods that we want to support include: 

 * @rename(old, @Manifest(manifest_text)@ 
 ** Constructor takes a string (default "") with which it populates a new Manifest object 
 * @Manifest.rename_file(old, new, dest_manifest=None)@ 
 ** Rename a file in the manifest from _old_ to _new_, updating all necessary lines in the manifest. If _dest_manifest_ is supplied, this atomically performs @copy@ @copy_file@ followed by @delete@. @delete_file@. 
 * @copy(old, @Manifest.copy_file(old, new, dest_manifest=None)@ 
 ** Add a new manifest entry for file _new_, duplicating the block list for existing file _old_. If _dest_manifest_ is supplied, the new entries should be added to that manifest instead. 
 * @delete(filename)@ @Manifest.delete_file(filename)@ 
 ** Remove all entries for _filename_ from the manifest. 
 * @create(filename, @Manifest.create_file(filename, stream=".", blocks=[])@ 
 ** Create a new manifest entry for _filename_. Use the specified stream and blocklist. 
 * @dirty()@ @Manifest.dirty()@ 
 ** Return _True_ if the manifest has been modified since last being created or saved to the API server, otherwise _False_. 

 If these methods are implemented in a new Manifest class: 

 * @Manifest(manifest_text)@ 
 ** Constructor takes a string (default "") with which it populates a new Manifest object 
 * @Manifest.str()@ 
 ** Returns a string containing the serialized text representing this manifest 

 Additional methods that are likely to prove useful include: 

 * @directory(dirname)@ 
 ** Returns an iterator that yields successive file basenames found in directory _dirname_ inside the manifest. 
 * @glob(globpattern)@ 
 ** Returns an iterator that yields successive files that match _globpattern_ from the manifest. 

Back