Created on 08.04.2011
@author: joe
Bases: cloudfusion.store.store.Store
Subclass of Store implementing an interface to the Amazon S3 storage. File objects are stored in a top level container called bucket. There are no directories. They are simulated by appending a slash to a file object. I.e. “somepath/” is a directory name, but “somepath” without the slash is considered a file. Amazon S3 provides an interface to list file objects with a certain prefix, and a delimiter, which is used to list single directories. I.e. bucket.list(“somepath/”, delimiter=”/”) returns a list of all file paths beginning with “somepath/” that do not contain a slash after the prefix or end in a slash. For instance: [“somepath/file1”, “somepath/dir1/”, “somepath/file2”]. For compatibility with other tools, file objects with content type “application/x-directory” or file objects ending with _$folder$ are recognized as directories, too.
config is a dictionary with the keys id (access_key_id), secret (secret_access_key), and bucket_name. For instance:
config['id'] = 'FDS54548SDF8D2S311DF'
config['secret'] = 'D370JKD=564++873ZHFD9FDKDD'
config['bucket_name'] = 'cloudfusion'
The bucket will be created if it does not exist. A bucket is similar to a subfolder,
to which access with CloudFusion is restricted.
Id and secret can be obtained from the console.aws.amazon.com/s3/home
* Click on your name on the top left and select Security Credentials form the drop down menu.
* Go to Access Keys and Generate New Access Keys to generate the new key pair.
Parameters: | config – dictionary with key value pairs |
---|
Used by retry decorator to react to errors.
Parameters: | key – instance of boto’s Key class |
---|---|
Returns: | True iff key is a directory |
Return maximum number of bytes per file
Bases: cloudfusion.store.s3.amazon_store.AmazonStore, cloudfusion.store.bulk_get_metadata.BulkGetMetadata
Subclass of AmazonStore, extending it by implementing the BulkGetMetadata interface for quick directory lising.
Returns: | A dictionary mapping the path of every file object in directory to a dictionary with the keys ‘modified’, ‘bytes’ and ‘is_dir’ containing the corresponding metadata for the file object. |
---|
The value for ‘modified’ is a date in seconds, stating when the file object was last modified. The value for ‘bytes’ is the number of bytes of the file object. It is 0 if the object is a directory. The value for ‘is_dir’ is True if the file object is a directory and False otherwise.
Raises: | NoSuchFilesytemObjectError if the directory does not exist |
---|