Archive Plugins¶
Archive Plugins can be used to integrate Cantemo with various archive solutions. The plugin will be responsible for copying a set of files from Cantemo to an archive, and to restore the files again. An archive plugin will need to implement two methods: one method to archive a set of files, and one method to restore a set of files.
A full clone of the Cantemo FileSys archive plugin is available for reference at https://github.com/Cantemo/filesysarchive
IArchivePlugin¶
- class portal.generic.plugin_interfaces.IArchivePlugin¶
An archive plugin is a plugin that’s responsible for archiving and restoring files. All required methods must be implemented.
- Requires:
- archive(file_sets, policy_uuid, job_id) - Plugin should archive all files in file_sets (from a single storage if
multiple are available) and return the file_sets-list of files that were archived. I.e. in normal case if all files where archived should return file_sets without modifications.
- restore(file_sets, policy_uuid) - Plugin should restore all files in file_sets, to a single storage if
multiple are listed. The framework will handle the case where a file should be available in multiple locations after restore. Returns the file_sets-list or files that were restored, i.e. in normal case if all files where restored should return file_sets without modifications. If the restore fails, the plugin should raise an exception with an error message that will be shown in the admin user interface.
- delete(file_sets, policy_uuid) - Plugin should delete the listed files from archive, and return the list
of files that were deleted.
- get_policies() - Return list of available storage policies for this plugin, in the simplest case a single
value [ { ‘uuid’: “filesys”, ‘bulk_support’: False } ]
- is_ready() - Should return True if and only if plugin is correctly configured and ready to
archive/restore files. For example should check that archival system is available at the address set by the user in the plugins setup interface. This return value of this function is cached for performance reasons, so, a change from False to True or from True to False, can some seconds or few minutes until it has an effective impact on Portal UI.
Optional: * get_policy_constrains() - Return list of constraints related to a bulk policy.
- Args:
file_sets - a list of portal.archive_framework.utils.FileSet objects
FileSet¶
- class portal.archive_framework.utils.FileSet(item_id, sha1, files, file_infos, external_ids)¶
FileSet(item_id, sha1, files, file_infos, external_id): information about a file of an item shape for archive/restore/delete.
item_id - Vidispine Item ID
sha1 - SHA1 of file contents
files - a list of full path names for files instances, e.g.
['/srv/media1/path/Ricochet.wav', '/srv/media2/path/Ricochet.wav', ...]
file_infos - a list of dicts with more information about each instance of the file.
external_ids - Value of metadata “portal_archive_external_id” for the file (Component). Used for Archiware P5 file handles and DIVArchive in cases where externally archived items are imported to Portal.
Example file_infos value:
[ { 'storage_id':'VX-1', 'path_within_storage':'path/Ricochet.wav', 'full_path': '/srv/media1/path/Ricochet.wav' }, { 'storage_id':'VX-2', 'path_within_storage':'path/Ricochet.wav', 'full_path': '/srv/media2/path/Ricochet.wav' }, ...]
Note
Remember to include roles for your plugin