~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cloud_ms.cc

  • Committer: Mark Atwood
  • Date: 2011-12-20 02:32:53 UTC
  • mfrom: (2469.1.1 drizzle-build)
  • Revision ID: me@mark.atwood.name-20111220023253-bvu0kr14kwsdvz7g
mergeĀ lp:~brianaker/drizzle/deprecate-pbms

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2009 PrimeBase Technologies GmbH, Germany
2
 
 *
3
 
 * PrimeBase Media Stream for MySQL
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
 
 *
19
 
 *  Created by Barry Leslie on 3/20/09.
20
 
 *
21
 
 */
22
 
 
23
 
#ifdef DRIZZLED
24
 
#include <config.h>
25
 
#include <drizzled/common.h>
26
 
#include <drizzled/session.h>
27
 
#include <drizzled/table.h>
28
 
#include <drizzled/message/table.pb.h>
29
 
#include <drizzled/charset.h>
30
 
#include <drizzled/table_proto.h>
31
 
#include <drizzled/session.h>
32
 
#include <drizzled/field.h>
33
 
#endif
34
 
 
35
 
#include "cslib/CSConfig.h"
36
 
 
37
 
#include <stdlib.h>
38
 
#include <ctype.h>
39
 
#include <string.h>
40
 
 
41
 
#include "cslib/CSGlobal.h"
42
 
#include "cslib/CSThread.h"
43
 
#include "cslib/CSLog.h"
44
 
#include "cslib/CSPath.h"
45
 
#include "cslib/CSFile.h"
46
 
#include "cslib/CSString.h"
47
 
#include "cslib/CSStrUtil.h"
48
 
#include "cslib/CSStorage.h"
49
 
#include "cslib/CSEncode.h"
50
 
#include "cslib/CSS3Protocol.h"
51
 
 
52
 
#include "backup_ms.h"
53
 
#include "cloud_ms.h"
54
 
 
55
 
CSSyncSparseArray       *MSCloudInfo::gCloudInfo;
56
 
uint32_t                        MSCloudInfo::gMaxInfoRef;
57
 
 
58
 
uint32_t                        CloudDB::gKeyIndex;
59
 
CSMutex                 CloudDB::gCloudKeyLock;
60
 
 
61
 
//==============================
62
 
MSCloudInfo::MSCloudInfo(uint32_t id,
63
 
                                                const char *server,
64
 
                                                const char *bucket_arg,
65
 
                                                const char *publicKey,
66
 
                                                const char *privateKey
67
 
                                                ):
68
 
        cloudRefId(id),
69
 
        bucket(NULL),
70
 
        s3Prot(NULL)
71
 
{               
72
 
        new_(s3Prot, CSS3Protocol());
73
 
        s3Prot->s3_setServer(server);
74
 
        s3Prot->s3_setPublicKey(publicKey);
75
 
        s3Prot->s3_setPrivateKey(privateKey);
76
 
        
77
 
        bucket = CSString::newString(bucket_arg);               
78
 
}
79
 
                
80
 
//-------------------------------
81
 
MSCloudInfo::~MSCloudInfo()
82
 
{
83
 
        if (bucket)
84
 
                bucket->release();
85
 
                
86
 
        if (s3Prot)
87
 
                s3Prot->release();
88
 
}
89
 
        
90
 
//-------------------------------
91
 
const char *MSCloudInfo::getServer() 
92
 
93
 
        return s3Prot->s3_getServer();
94
 
}
95
 
 
96
 
//-------------------------------
97
 
const char *MSCloudInfo::getBucket() 
98
 
99
 
        return bucket->getCString();
100
 
}
101
 
 
102
 
//-------------------------------
103
 
const char *MSCloudInfo::getPublicKey() 
104
 
105
 
        return s3Prot->s3_getPublicKey();
106
 
}
107
 
 
108
 
//-------------------------------
109
 
const char *MSCloudInfo::getPrivateKey() 
110
 
111
 
        return s3Prot->s3_getPrivateKey();
112
 
}
113
 
 
114
 
//-------------------------------
115
 
CSString *MSCloudInfo::getSignature(const char *key, const char *content_type, uint32_t *s3AuthorizationTime)
116
 
{
117
 
        return s3Prot->s3_getAuthorization(bucket->getCString(), key, content_type, s3AuthorizationTime);
118
 
}
119
 
 
120
 
//-------------------------------
121
 
CSString *MSCloudInfo::getDataURL(const char *key, int keep_alive)
122
 
{
123
 
        return s3Prot->s3_getDataURL(bucket->getCString(), key, keep_alive);
124
 
}
125
 
 
126
 
//-------------------------------
127
 
void MSCloudInfo::send(CSInputStream *input, const char *key, off64_t size)
128
 
{
129
 
        CSVector *headers;
130
 
        headers = s3Prot->s3_send(input, bucket->getCString(), key, size);
131
 
        headers->release();
132
 
}
133
 
 
134
 
//-------------------------------
135
 
CSVector *MSCloudInfo::list(const char *key_prefix, uint32_t max)
136
 
{
137
 
        return s3Prot->s3_list(bucket->getCString(), key_prefix, max);
138
 
}
139
 
 
140
 
//-------------------------------
141
 
void MSCloudInfo::receive(CSOutputStream *output, const char *key)
142
 
{
143
 
        bool found;
144
 
        CSVector *headers;
145
 
        
146
 
        headers = s3Prot->s3_receive(output, bucket->getCString(), key, &found);
147
 
        headers->release();
148
 
        if (!found) {
149
 
                CSStringBuffer *err;
150
 
                enter_();
151
 
                
152
 
                new_(err, CSStringBuffer());
153
 
                push_(err);
154
 
                err->append("S3 object not found: ");
155
 
                err->append(getServer());
156
 
                err->append("/");
157
 
                err->append(bucket->getCString());
158
 
                err->append("/");
159
 
                err->append(key);
160
 
 
161
 
                CSException::throwException(CS_CONTEXT, CS_ERR_GENERIC_ERROR, err->getCString());
162
 
                release_(err);
163
 
                outer_();
164
 
        }
165
 
}
166
 
 
167
 
//-------------------------------
168
 
void MSCloudInfo::cDelete(const char *key)
169
 
{
170
 
        s3Prot->s3_delete(bucket->getCString(), key);
171
 
}
172
 
 
173
 
//-------------------------------
174
 
void MSCloudInfo::copy(MSCloudInfo *dst_cloud, const char *dst_key, const char *src_key)
175
 
{
176
 
        enter_();
177
 
        push_(dst_cloud);
178
 
        
179
 
        s3Prot->s3_copy(dst_cloud->getServer() ,dst_cloud->bucket->getCString(), dst_key, bucket->getCString(), src_key);
180
 
 
181
 
        release_(dst_cloud);
182
 
        exit_();
183
 
}
184
 
 
185
 
//==============================
186
 
CloudDB::CloudDB(uint32_t db_id):
187
 
        dfltCloudRefId(0),
188
 
        keep_alive(5 * 60),// default URL keep alive in seconds.
189
 
        blob_recovery_no(0),
190
 
        blob_db_id(db_id),
191
 
        isBackup(false),
192
 
        backupInfo(NULL),
193
 
        backupCloud(NULL),
194
 
        clObjectKey(NULL)
195
 
{
196
 
        enter_();
197
 
 
198
 
        new_(clObjectKey, CSStringBuffer());
199
 
        clObjectKey->setLength(base_key_size);
200
 
                
201
 
        exit_();
202
 
}
203
 
 
204
 
//-------------------------------
205
 
CloudDB::~CloudDB()
206
 
{
207
 
        
208
 
        if (backupInfo)
209
 
                backupInfo->release();
210
 
                
211
 
        if (backupCloud)
212
 
                backupCloud->release();
213
 
                
214
 
        if (clObjectKey)
215
 
                clObjectKey->release();
216
 
                
217
 
}
218
 
//-------------------------------
219
 
MSBackupInfo *CloudDB::cl_getBackupInfo()
220
 
221
 
        if (backupInfo)
222
 
                backupInfo->retain();
223
 
                
224
 
        return backupInfo;
225
 
}
226
 
 
227
 
//-------------------------------
228
 
void CloudDB::cl_clearBackupInfo(){ backupInfo->release(); backupInfo = NULL;}
229
 
 
230
 
//-------------------------------
231
 
void CloudDB::cl_createDB()
232
 
{
233
 
// This is a no-op. 
234
 
}
235
 
 
236
 
//-------------------------------
237
 
// Restore all the 
238
 
void CloudDB::cl_restoreDB()
239
 
{
240
 
        CSVector *list = NULL;
241
 
        CSString *key = NULL;
242
 
        CloudObjectKey *src_objectKey = NULL, *dst_objectKey = NULL;
243
 
        CloudKeyRec             cloudKey;
244
 
        uint32_t                src_cloudRef, dst_cloudRef = 0;
245
 
        MSBackupInfo    *backup_info = NULL;
246
 
        MSCloudInfo             *src_cloud = NULL, *dst_cloud = NULL;
247
 
        enter_();
248
 
 
249
 
        if (!blob_recovery_no)
250
 
                exit_(); // nothing to do.
251
 
 
252
 
        backup_info = MSBackupInfo::getBackupInfo(blob_recovery_no);
253
 
        push_(backup_info);
254
 
        
255
 
        src_cloudRef = backup_info->getcloudRef();
256
 
        src_cloud = MSCloudInfo::getCloudInfo(src_cloudRef);
257
 
        push_(src_cloud);
258
 
        
259
 
        new_(dst_objectKey, CloudObjectKey(blob_db_id));
260
 
        push_(dst_objectKey);
261
 
        
262
 
        // Get the key for the backup BLOB
263
 
        new_(src_objectKey, CloudObjectKey(blob_db_id));
264
 
        push_(src_objectKey);
265
 
        src_objectKey->setObjectKey(NULL, backup_info->getcloudBackupNo(), backup_info->getDatabaseId()); 
266
 
 
267
 
        // Get a list of all the BLOBs that were backed up.
268
 
        list = src_cloud->list(src_objectKey->getCString());
269
 
        release_(src_objectKey);
270
 
        push_(list);
271
 
        
272
 
        
273
 
        // Go through the list copying the keys.
274
 
        dst_cloudRef = src_cloudRef;
275
 
        dst_cloud = src_cloud;
276
 
        dst_cloud->retain();
277
 
        
278
 
        push_ref_(dst_cloud); // Push a reference to dst_cloud so that what ever it references will be released.
279
 
 
280
 
        while ((key = (CSString*)(list->take(0))) ) {
281
 
                push_(key);
282
 
 
283
 
                // The source key name must be parsed to get its
284
 
                // destination cloud reference. The destination for
285
 
                // the BLOBs may not all be in the same cloud. 
286
 
                CloudObjectKey::parseObjectKey(key->getCString(), &cloudKey);
287
 
                
288
 
                // Reset the destination cloud if required.
289
 
                if (cloudKey.cloud_ref != dst_cloudRef) {
290
 
                        if (dst_cloud) {
291
 
                                dst_cloud->release();
292
 
                                dst_cloud = NULL;
293
 
                        }
294
 
                        dst_cloudRef =  cloudKey.cloud_ref;
295
 
                        dst_cloud = MSCloudInfo::getCloudInfo(dst_cloudRef);
296
 
                }
297
 
 
298
 
                // Copy the BLOB to the recovered database.
299
 
                dst_objectKey->setObjectKey(&cloudKey);
300
 
                src_cloud->copy(RETAIN(dst_cloud), dst_objectKey->getCString(), key->getCString());
301
 
                release_(key);
302
 
                
303
 
        }
304
 
        
305
 
        release_(dst_cloud);
306
 
        
307
 
        blob_recovery_no = 0;
308
 
        release_(list);
309
 
        release_(dst_objectKey);        
310
 
        release_(src_cloud);
311
 
        release_(backup_info);
312
 
        exit_();        
313
 
}
314
 
 
315
 
//-------------------------------
316
 
uint32_t CloudDB::cl_getNextBackupNumber(uint32_t cloud_ref)
317
 
{
318
 
        CloudObjectKey *objectKey;
319
 
        CSVector *list;
320
 
        uint32_t backup_no = 0, size = 1;
321
 
        MSCloudInfo *s3Cloud;
322
 
        enter_();
323
 
 
324
 
        s3Cloud = MSCloudInfo::getCloudInfo((cloud_ref)?cloud_ref:dfltCloudRefId);
325
 
        push_(s3Cloud);
326
 
        
327
 
        new_(objectKey, CloudObjectKey(blob_db_id));
328
 
        push_(objectKey);
329
 
 
330
 
        // Find the next available backup number
331
 
        while (size) {
332
 
                backup_no++;
333
 
                objectKey->setObjectKey(NULL, backup_no); // use the key prefix with the backup number for listing.
334
 
                list = s3Cloud->list(objectKey->getCString(), 1);
335
 
                size = list->size();
336
 
                list->release();
337
 
        }
338
 
        
339
 
        release_(objectKey);
340
 
        release_(s3Cloud);
341
 
 
342
 
        return_(backup_no);
343
 
}
344
 
 
345
 
//-------------------------------
346
 
void CloudDB::cl_backupBLOB(CloudKeyPtr key)
347
 
{
348
 
        CloudObjectKey *src_objectKey, *dst_objectKey;
349
 
        uint32_t cloudRef, backupNo;
350
 
        MSCloudInfo *src_cloud = NULL, *dst_cloud = NULL;
351
 
        enter_();
352
 
 
353
 
        ASSERT(backupInfo);
354
 
        
355
 
        if ((cloudRef = backupInfo->getcloudRef()) == 0) {
356
 
                backupInfo->setcloudRef(dfltCloudRefId);
357
 
                cloudRef = dfltCloudRefId;
358
 
        }
359
 
                
360
 
        if ((backupNo = backupInfo->getcloudBackupNo()) == 0) {         
361
 
                backupNo = cl_getNextBackupNumber(cloudRef);
362
 
                backupInfo->setcloudBackupNo(backupNo);
363
 
        }
364
 
        
365
 
        // Set the source object's key
366
 
        new_(src_objectKey, CloudObjectKey(blob_db_id));
367
 
        push_(src_objectKey);
368
 
        src_objectKey->setObjectKey(key);
369
 
 
370
 
        // Set the destination object's key
371
 
        new_(dst_objectKey, CloudObjectKey(blob_db_id));
372
 
        push_(dst_objectKey);
373
 
        dst_objectKey->setObjectKey(key, backupNo);
374
 
 
375
 
        // Get the source cloud
376
 
        src_cloud = MSCloudInfo::getCloudInfo((key->cloud_ref)?key->cloud_ref:dfltCloudRefId);
377
 
        push_(src_cloud);
378
 
        
379
 
        // Copy the object to the destination cloud
380
 
        dst_cloud = MSCloudInfo::getCloudInfo(cloudRef);
381
 
        src_cloud->copy(dst_cloud, dst_objectKey->getCString(), src_objectKey->getCString());
382
 
 
383
 
        release_(src_cloud);
384
 
        release_(dst_objectKey);
385
 
        release_(src_objectKey);
386
 
        exit_();
387
 
}
388
 
 
389
 
//-------------------------------
390
 
void CloudDB::cl_restoreBLOB(CloudKeyPtr key, uint32_t backup_db_id)
391
 
{
392
 
        CloudObjectKey *src_objectKey, *dst_objectKey;
393
 
        uint32_t cloudRef, backupNo;
394
 
        MSCloudInfo *src_cloud = NULL, *dst_cloud = NULL;
395
 
        enter_();
396
 
 
397
 
        ASSERT(backupInfo);
398
 
        
399
 
        if ((cloudRef = backupInfo->getcloudRef()) == 0) {
400
 
                backupInfo->setcloudRef(dfltCloudRefId);
401
 
                cloudRef = dfltCloudRefId;
402
 
        }
403
 
                
404
 
        if ((backupNo = backupInfo->getcloudBackupNo()) == 0) {         
405
 
                backupNo = cl_getNextBackupNumber(cloudRef);
406
 
                backupInfo->setcloudBackupNo(backupNo);
407
 
        }
408
 
        
409
 
        // Set the source object's key
410
 
        new_(src_objectKey, CloudObjectKey(backup_db_id));
411
 
        push_(src_objectKey);
412
 
        src_objectKey->setObjectKey(key, backupNo);
413
 
 
414
 
        // Set the destination object's key
415
 
        new_(dst_objectKey, CloudObjectKey(blob_db_id));
416
 
        push_(dst_objectKey);
417
 
        dst_objectKey->setObjectKey(key);
418
 
 
419
 
        // Get the source cloud
420
 
        src_cloud = MSCloudInfo::getCloudInfo(cloudRef);
421
 
        push_(src_cloud);
422
 
        
423
 
        // Copy the object to the destination cloud
424
 
        dst_cloud = MSCloudInfo::getCloudInfo((key->cloud_ref)?key->cloud_ref:dfltCloudRefId);
425
 
        src_cloud->copy(dst_cloud, dst_objectKey->getCString(), src_objectKey->getCString());
426
 
 
427
 
        release_(src_cloud);
428
 
        release_(dst_objectKey);
429
 
        release_(src_objectKey);
430
 
        exit_();
431
 
}
432
 
 
433
 
//-------------------------------
434
 
// Drop database deletes all objects with the database key prefix
435
 
void CloudDB::cl_dropDB()
436
 
{
437
 
        CSVector *list;
438
 
        CSString *key;
439
 
        CloudObjectKey *objectKey;      
440
 
        MSCloudInfo *s3Cloud = NULL;
441
 
        int i;
442
 
        const char *key_str;
443
 
        
444
 
        enter_();
445
 
        new_(objectKey, CloudObjectKey(blob_db_id));
446
 
        push_(objectKey);
447
 
        
448
 
        lock_(MSCloudInfo::gCloudInfo);
449
 
 
450
 
        if (isBackup) {
451
 
                uint32_t backup_no;
452
 
                if (backupInfo && (backup_no = backupInfo->getcloudBackupNo())) {
453
 
                        objectKey->setObjectKey(NULL, backup_no); // use the key prefix for the backup for listing.
454
 
                        if ((s3Cloud = MSCloudInfo::getCloudInfo(backupInfo->getcloudRef())))
455
 
                                push_(s3Cloud);
456
 
                }
457
 
        } else {
458
 
                objectKey->setObjectKey(); // use the key prefix for listing.
459
 
                i = 0;
460
 
                s3Cloud = (MSCloudInfo*)MSCloudInfo::gCloudInfo->itemAt(i++); // <-- unreferenced object 
461
 
        }
462
 
                
463
 
        key_str = objectKey->getCString();
464
 
 
465
 
        // For non backup BLOBs all known clouds must be searched 
466
 
        // for possible BLOBs and deleted. The BLOBs belonging to a backup
467
 
        // will ever only be in one cloud storage location.
468
 
        while (s3Cloud) {
469
 
                list = s3Cloud->list(key_str);
470
 
                push_(list);
471
 
                
472
 
                // Go through the list deleting the keys.
473
 
                while ((key = (CSString*)(list->take(0))) ) {
474
 
                        push_(key);
475
 
                        s3Cloud->cDelete(key->getCString());
476
 
                        release_(key);
477
 
                }
478
 
                
479
 
                release_(list);
480
 
                if (isBackup) {
481
 
                        release_(s3Cloud); // Only the backup s3Cloud needs to be released.
482
 
                        s3Cloud = NULL;
483
 
                } else
484
 
                        s3Cloud = (MSCloudInfo*)MSCloudInfo::gCloudInfo->itemAt(i++);// <-- unreferenced object
485
 
        }
486
 
        
487
 
        unlock_(MSCloudInfo::gCloudInfo);
488
 
        release_(objectKey);
489
 
        exit_();
490
 
}
491
 
 
492
 
//-------------------------------
493
 
void CloudDB::cl_putData(CloudKeyPtr key, CSInputStream *stream, off64_t size)
494
 
{
495
 
        CloudObjectKey *objectKey;
496
 
        MSCloudInfo *s3Cloud;
497
 
        
498
 
        enter_();
499
 
        
500
 
        push_(stream);
501
 
        
502
 
        new_(objectKey, CloudObjectKey(blob_db_id));
503
 
        push_(objectKey);
504
 
        
505
 
        objectKey->setObjectKey(key);
506
 
        
507
 
        s3Cloud = MSCloudInfo::getCloudInfo((key->cloud_ref)?key->cloud_ref:dfltCloudRefId);
508
 
        push_(s3Cloud);
509
 
        s3Cloud->send(RETAIN(stream), objectKey->getCString(), size);
510
 
        release_(s3Cloud);
511
 
        
512
 
        release_(objectKey);
513
 
        release_(stream);
514
 
        
515
 
        exit_();
516
 
}
517
 
 
518
 
//-------------------------------
519
 
off64_t CloudDB::cl_getData(CloudKeyPtr key,  char *buffer, off64_t size)
520
 
{       
521
 
        CloudObjectKey *objectKey;
522
 
        CSStaticMemoryOutputStream *output;
523
 
        MSCloudInfo *s3Cloud;
524
 
        enter_();
525
 
        
526
 
        new_(objectKey, CloudObjectKey(blob_db_id));
527
 
        push_(objectKey);
528
 
        
529
 
        s3Cloud = MSCloudInfo::getCloudInfo(key->cloud_ref);
530
 
        push_(s3Cloud);
531
 
 
532
 
        new_(output, CSStaticMemoryOutputStream((u_char *)buffer, size));
533
 
        push_(output);
534
 
        
535
 
        objectKey->setObjectKey(key);
536
 
        
537
 
        s3Cloud->receive(RETAIN(output), objectKey->getCString());      
538
 
        size = output->getSize();
539
 
        release_(output);
540
 
        
541
 
        release_(s3Cloud);
542
 
        release_(objectKey);
543
 
        return_(size);
544
 
}
545
 
 
546
 
//-------------------------------
547
 
void CloudDB::cl_deleteData(CloudKeyPtr key)
548
 
{
549
 
        MSCloudInfo *s3Cloud;
550
 
        CloudObjectKey *objectKey;
551
 
        enter_();
552
 
        
553
 
        new_(objectKey, CloudObjectKey(blob_db_id));
554
 
        push_(objectKey);
555
 
        
556
 
        s3Cloud = MSCloudInfo::getCloudInfo(key->cloud_ref);
557
 
        push_(s3Cloud);
558
 
 
559
 
        objectKey->setObjectKey(key);
560
 
 
561
 
        s3Cloud->cDelete(objectKey->getCString());      
562
 
        
563
 
        release_(s3Cloud);
564
 
        release_(objectKey);
565
 
 
566
 
        exit_();
567
 
}
568
 
 
569
 
//-------------------------------
570
 
CSString *CloudDB::cl_getDataURL(CloudKeyPtr key)
571
 
{
572
 
        CloudObjectKey *objectKey;
573
 
        CSString *url;
574
 
        MSCloudInfo *s3Cloud;
575
 
        enter_();
576
 
        
577
 
        new_(objectKey, CloudObjectKey(blob_db_id));
578
 
        push_(objectKey);
579
 
        
580
 
        objectKey->setObjectKey(key);
581
 
        
582
 
        s3Cloud = MSCloudInfo::getCloudInfo(key->cloud_ref);  
583
 
        push_(s3Cloud);
584
 
                
585
 
        url = s3Cloud->getDataURL(objectKey->getCString(), keep_alive);
586
 
        
587
 
        release_(s3Cloud);
588
 
        release_(objectKey);
589
 
 
590
 
        return_(url);
591
 
}
592
 
 
593
 
//-------------------------------
594
 
CSString *CloudDB::cl_getSignature(CloudKeyPtr key, CSString *content_type_arg, uint32_t *s3AuthorizationTime)
595
 
{
596
 
        CSString *signature;
597
 
        CloudObjectKey *objectKey;
598
 
        const char *content_type = NULL;
599
 
        MSCloudInfo *s3Cloud;
600
 
        enter_();
601
 
        
602
 
        new_(objectKey, CloudObjectKey(blob_db_id));
603
 
        push_(objectKey);
604
 
        
605
 
        if (content_type_arg) {
606
 
                push_(content_type_arg);
607
 
                content_type = content_type_arg->getCString();
608
 
        }
609
 
        
610
 
        objectKey->setObjectKey(key);
611
 
        s3Cloud = MSCloudInfo::getCloudInfo(key->cloud_ref);  
612
 
        push_(s3Cloud);
613
 
        
614
 
        signature = s3Cloud->getSignature(objectKey->getCString(), content_type, s3AuthorizationTime);
615
 
        
616
 
        if (content_type_arg) 
617
 
                release_(content_type_arg);
618
 
 
619
 
        release_(s3Cloud);
620
 
        release_(objectKey);
621
 
        
622
 
        return_(signature);
623
 
}
624
 
 
625
 
//==============================
626