The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::CEPH

DESCRIPTION

CEPH client for simple workflow, supporting multipart uploads.

Clint for CEPH, without a low-level code to communicate with the Amazon S3 library (it is placed in a separate class).

Lower-level library is responsible for error handling (exceptions and failed requests retries), unless otherwise guaranteed in this documentation.

Constructor parameters:

Required parameters:

protocol - http/https

host - backend host

key - access key

secret - access secret

Optional parameters:

bucket - name of the bucket (not needed just to get the list of buckets)

driver_name - at the moment only 'NetAmazonS3' is supported

multipart_threshold - the size threshold in bytes used for multipart uploads

multisegment_threshold - the size threshold in bytes used for multisegment downloads

query_string_authentication_host_replace - host/protocol on which to replace the URL in query_string_authentication_uri should start with the protocol (http / https), then the host, at the end optional slash. This parameter is needed if you want to change the host for return to clients (you have a cluster) or protocol (https for external clients)

new

Constructor. See the parameters above.

upload

Uploads the file into CEPH. If the file already exists, it is replaced. If the data is larger than a certain size, multipart upload is started. Returns nothing

Parameters:

0th - $self

1-st - key name

2-nd - scalar, key data

3-rd - Content-type. If undef, the default binary / octet-stream is used

upload_from_file

Same as upload method, but reads from file.

Parameters:

0th - $self

1-st - key name

2-nd - file name (if scalar), otherwise opens filehandle

3-rd - Content-type. If undef, the default binary / octet-stream is used

Double walks through the file, calculating md5. The file should not be a pipe, its size should not vary.

_upload

Private method for upload/upload_from_file

Parameters

1) self

2) key

3) iterator with interface (data, offset, length). "data" must correspond to the last parameter of this function (ie (6))

4) data length

5) previously calculated md5 from the data

6) Content-type. If undef, the default binary / octet-stream is used

7) data. or a scalar. or filehandle

download

Downloads data from an object named $key and returns it. If the object does not exist, it returns undef.

If the size of the object is actually greater than multisegment_threshold, the object will be downloaded by several requests with heading Range (ie, multi segment download).

At the moment there is a workaround for the bug http://lists.ceph.com/pipermail/ceph-users-ceph.com/2016-June/010704.html, in connection with this, an extra HTTP request is always made - the request for the length of the file. Plus Race condition is not excluded.

download_to_file

Downloads the data of the object with the name $key to the file $fh_or_filename. If the object does not exist, it returns undef (in this case the output file will be corrupted and, possibly, partially written due to the case of race condition - delete this data yourself, or delete it using the download method). Otherwise, returns the size of the written data. The output file is opened in overwrite mode, if this is the file name, if it is a filehandle, it is trimmed to zero length and written from the beginning.

If the size of the object is actually greater than multisegment_threshold, the object will be downloaded by several requests with heading Range (ie, multi segment download).

At the moment there is a workaround for the bug http://lists.ceph.com/pipermail/ceph-users-ceph.com/2016-June/010704.html, in connection with this, an extra HTTP request is always made - the request for the length of the file. Plus Race condition is not excluded.

_download

Private method for download/download_to_file

Parameters:

1) self

2) key name

3) appender - the closure in which the data for recording will be transmitted. it should accumulate them somewhere to itself or write to a file that it knows.

size

Returns the size of the object named $key in bytes, if the key does not exist, returns undef

delete

Removes an object named $key, returns nothing. If the object does not exist, it does not produce an error

query_string_authentication_uri

Returns Query String Authentication URL for key $key, with expire $expires

$expires - epoch time. But a low-level library can accept other formats. make sure that the input data is validated and you transfer exactly epoch

Replaces the host if there is a query_string_authentication_host_replace option (see the constructor)

get_buckets_list

Returns buckets list

WARNING

The method throws error "Attribute (owner_id) does not pass the type constraint because: Validation failed for 'OwnerId'"

Notifications sent to the developers: http://tracker.ceph.com/issues/16806 https://github.com/rustyconover/net-amazon-s3/issues/18

list_multipart_uploads

Returns the list of multipart downloads in a bucket

delete_multipart_upload

Deletes multipart download in bucket

Positional parameters: $key, $upload_id

Returns nothing