Skip to content

Get a Version of an Object

Naomi Dushay edited this page Jan 10, 2018 · 3 revisions

These notes are shamelessly cribbed, with permission, from a UCSD doc "Using Moab Versioning System for Chronopolis (Kai Lin - December 2016)" https://docs.google.com/document/d/14p3EMRHjoo_osOCRgwaIGCoACUr1yoZmSbJ0fXwGWAk

Get a Version of an Object

Moab provides many functions to get the attributes of an object in the storage repository.

# Find the storage object for jq937jp0017
storage_repository = Moab::StorageRepository.new()
storage_object = storage_repository.find_storage_object(“jq937jp0017”)
 
# List all the versions of jq937jp0017
version_list = storage_object.version_list
 
# Get the current (latest) version of jq937jp0017
current_storage_object_version = storage_object.current_version
 
# Get the representation of the second version’s storage area
storage_object_version_2 = storage_object.find_object_version(2)
 
# Reconstruct the second version of jq937jp0017 and package as a bag       
storage_object.reconstruct_version(2, bag_dir)

The method reconstruct_version retrieves a specific version of an object as a bag for use.