Data Store

Purpose:

  • Store artifacts and other file-based data.

Requirements

  • Accept both private and public files.
  • Give access via HTTP to public files.
  • Provide a library based API for other components to use.

Proposed API

DataStore(component, identifier=None)
Creates a data store object which is used to communicate with the swift service. The component and identifier are used internally to select the correct container in which to store the data.
list_files()
List the files in the container
put_file(filename, contents)
Add a file to the data store.
get_file(filename)
Get a file from the data store.
change_visibility(filename, private=False)
Used to make public files private and private files public.
delete_file(filename)
Remove a file from the data store.
delete(recursive=False)
Remove the container.
file_path(filename)
Get the public url for a file.
clear()
Remove all files from the container.
change_visibility(public=False)
Make the container public/private.

Internal Methods

_create_container(container_name)

_get_container(component, identifier=None)

_get_container_url()

_get_file_name(filename)

_has_file(filename)

_setup_auth()