WebService::CEPH::NetAmazonS3
Driver for CEPH is based on Net::Amazon::S3.
Made rather not on the basis Net::Amazon::S3, but on the basis Net::Amazon::S3::Client see POD https://metacpan.org/pod/Net::Amazon::S3::Client There is a separate documentation and it is said that this is a newer interface, while in the Net::Amazon::S3, there is no link to this.
Goes into private methods and not documented features of Net :: Amazon :: S3, due to the fact that Net :: Amazon :: S3 is not well-documented in principle, and there is not enough public functionality in it.
The stability of this solution is provided by the integration test netamazons3_integration, which in theory tests everything. The problems can only be if you installed this module, then updated Net :: Amazon :: S3 to a new version that did not exist yet, which broke back compatibility of private methods.
The interface of this module is documented. Stick to what is documented, WebService :: CEPH counts on all this. You can write your driver with the same interface, but with a different implementation.
new
Constructor
protocol - 'http' or 'https'
host - Amazon S3 host or CEPH
bucket - (mandatory for all operations except the request for the bucket list) the name of the bucket, this bucket will be used for all object operations
key - access key
secret - access secret
_request_object
Private method. Returns the Net :: Amazon :: S3 :: Client :: Bucket object, which can then be used. Used in code several times
get_buckets_list
Returns buckets list
upload_single_request
Uploads data.
Parameters:
1) $self
2) $key - object name
3) data itself (blob)
4) Content-Type, optional
5) ACL, optional
Upload an object for one request (non-multipart upload), put a custom or private ACL, add a custom x-amz-meta-md5 header, which equals md5 hex from the file
list_multipart_uploads
Returns a list multipart_upload
Parameters:
none
Returns: [ { key => 'Upload key', upload_id => 'Upload ID', initiated => 'Init date', initiated_epoch => same as initiated but in epoch time format initiated_age_seconds => simply time() - initiated_epoch ie upload age }, ... ]
delete_multipart_upload
Deletes upload
Parameters: $key, $upload_id
initiate_multipart_upload
Initiates multipart upload
Parameters:
1) $self
2) $key - object name
3) md5 from data
4) Content-type, optional
5) ACL, optional
Initiates multipart upload, sets x-amz-meta-md5 to md5 value of the file (needs to be calculated in advance and pass it as a parameter). Returns a reference to a structure of an undocumented nature, which should be used later to work with this multipart upload
upload_part
Uploads part of the data when multipart uploading
Parameters:
1) $self
2) $multipart_upload - reference, obtained from initiate_multipart_upload
3) $part_number - part number, from 1 and higher.
Works only if parts were uploaded in turn with increasing numbers (which is natural, if it is sequential uploading, and makes it impossible for parallel upload from different processes)
Returns nothing
complete_multipart_upload
Finalize multipart upload
Parameters:
1) $self
2) $multipart_upload - reference, obtained from initiate_multipart_upload
returns nothing. throws an exception, if something is wrong.
download_with_range
Downloads an object with the HTTP Range header (ie, part of the data).
Parameters:
1) $self
2) $key - object name
3) $first - first byte for Range
4) $last - last byte for Range
If $first, $last are missing or undef, the entire file is downloaded, without the Range header
If $last is missing, downloads data from a specific position to the end (as well as in the Range specification).
If the object is missing, returns an empty list. If other error - an exception.
Returns:
1) Scalar Ref on downloaded data
2) The number of remaining bytes that can still be downloaded (or undef, if $first parameter was not present)
3) ETag header with deleted quotes (or undef if it is missing)
4) X-Amz-Meta-Md5 header (or undef if it is missing)
size
Gets the size of the object using the HTTP HEAD request.
Parameters:
1) $self
2) $key - object name
If the object does not exist, it returns undef. If other error - an exception. Returns size in bytes.
delete
Deletes an object
Parameters:
1) $self
2) $key - object name
Returns nothing. If the object did not exist, does not signal about it.
query_string_authentication_uri
Returns Query String Authentication URL for key $key, with expire time $expires