Is it possible to take an image in your object store and create its thumbnail without moving data into or out of the object store? Swift Storlets could be used to transform data. However, currently a storlet can only be invoked during an upload or during a download of an object to Swift. Invoking a storlet during upload means that the actual object being created in the store is not the uploaded data, but rather the storlet computation result over it. Similarly, invoking a storlet during download means that the data being returned to the user is not the data stored in the system, but rather the storlet computation result over the stored data. A fundamental functionality that was missing from the storlet engine is the ability to run a storlet over an existing object and have the result written to a newly created object. Being able to do that facilitates transformations over existing objects without the need to download them. We have now added the capability to run a storlet over an existing object with the result being stored in a new object. To do so, we use Swift’s syntax. In Swift there are two ways to copy an object:

1. Do a PUT together with the X-Copy-From header

Example: [code language=”Swift”] PUT v1/<account>/<container>/<object> X-Copy-From: <source container>/<source object> [/code] With this syntax, the object specified in the PUT request path will be created from the source object appearing in the X-Copy-From header

2. Use the HTTP Copy verb with the HTTP Destination header

Example: [code language=”Swift”] COPY v1/<account>/<source_container>/<source_object> Destination: <container>/<object> [/code] With this syntax the object specified in the Destination header will be created from the source object appearing in the COPY path. Invoking a storlet on copy is as simple as invoking it during GET or PUT. Just add the “X-Run-Storlet” header with the storlet you wish to invoke using either of the above copy syntaxes.

Join The Discussion

Your email address will not be published. Required fields are marked *