- g_print("Starting store of %s to S3 at %ld...\n", key, bluesky_now_hires());
- S3_put_object(&store->bucket, key, encrypted->len, NULL, NULL,
- &handler, &info);
+static void s3store_task(gpointer o, gpointer s)
+{
+ S3Store *store = (S3Store *)s;
+ S3Op *op = (S3Op *)o;
+
+ g_print("Start task [key=%s]...\n", op->key);
+
+ if (op->op == S3_PUT) {
+ BlueSkyRCStr *encrypted = bluesky_crypt_encrypt(op->data,
+ store->encryption_key);
+
+ struct put_info info;
+ info.val = encrypted;
+ info.offset = 0;
+
+ struct S3PutObjectHandler handler;
+ handler.responseHandler.propertiesCallback
+ = s3store_properties_callback;
+ handler.responseHandler.completeCallback = s3store_response_callback;
+ handler.putObjectDataCallback = s3store_put_handler;
+
+ g_print("Starting store of %s to S3 at %ld...\n",
+ op->key, bluesky_now_hires());
+ S3_put_object(&store->bucket, op->key, encrypted->len, NULL, NULL,
+ &handler, &info);
+
+ bluesky_string_unref(encrypted);
+ }
+
+ bluesky_string_unref(op->data);
+ g_free(op->key);
+ g_free(op);