]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
non working download client
authorAbhishek Lekshmanan <abhishek@suse.com>
Wed, 22 Feb 2017 16:13:03 +0000 (17:13 +0100)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 10 Apr 2018 15:03:10 +0000 (08:03 -0700)
basically readrestresourcecr has enforced a rule where only Json types
can be parsed :/

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_sync_module_aws.cc

index c40b9fa19dbbe4cb5a81d31d0b66d6b9cce675cf..ad798039883c2f8265d401e62d4ba2d90be448d9 100644 (file)
@@ -28,6 +28,7 @@ struct AWSConfig {
 // maybe use Fetch Remote Obj instead?
 class RGWAWSHandleRemoteObjCBCR: public RGWStatRemoteObjCBCR {
   const AWSConfig& conf;
+  bufferlist res;
 public:
   RGWAWSHandleRemoteObjCBCR(RGWDataSyncEnv *_sync_env,
                             RGWBucketInfo& _bucket_info,
@@ -37,11 +38,13 @@ public:
   int operate () override {
     auto store = sync_env->store;
     RGWRESTConn *conn = store->rest_master_conn;
+
     if (conn == nullptr)
       return -EIO;
 
     reenter(this) {
-      ldout(sync_env->cct, 0) << "SYNC_BEGIN: stat of remote obj z=" << sync_env->source_zone
+
+      ldout(sync_env->cct, 0) << "AWS: download begin: z=" << sync_env->source_zone
                               << " b=" << bucket_info.bucket << " k=" << key << " size=" << size
                               << " mtime=" << mtime << " attrs=" << attrs
                               << dendl;
@@ -50,22 +53,39 @@ public:
         // and here be dragons!
         // ultimately we should be using a form of  fetch obj that doesn't write to rados maybe?
 
-        ldout(store->ctx(),0) << "abhi: If you're reading this, wait till things work!" << dendl;
         string obj_path = bucket_info.bucket.name + "/" + key.name;
-        string res = nullptr;
-        call(new RGWReadRESTResourceCR<string>(sync_env->cct,
+        ldout(store->ctx(),0) << "abhi: path=" << obj_path << dendl;
+
+        // Don't try this at home, very hacky, probably need a proper aws client
+        // written so RESTResourceCR expects a JSON as a result, we workaround
+        // by providing a list which is a native json type
+
+        // And we should do a part by part get and initiate mp on the aws side
+        call(new RGWReadRESTResourceCR<bufferlist>(sync_env->cct,
                                                conn,
                                                sync_env->http_manager,
                                                obj_path,
                                                nullptr,
                                                &res));
-        ldout(store->ctx(),0) << "abhi, printing obj" << dendl;
-        ldout(store->ctx(),0) << res << dendl;
 
       }
+      if (retcode < 0) {
+        return set_cr_error(retcode);
+      }
+      ldout(sync_env->cct,0) << "abhi: download complete, printing object res:=" << res.c_str() << dendl;
+      //ldout(sync_env->cct, 0) << "abhi: list size" << res.size() << dendl;
+      // yield {
+      //   // implement me here should be the coroutine to send the stuff we received to aws
 
 
+
+
+      // };
+
+      return set_cr_done();
     }
+
+    return 0;
   }
 };
 
@@ -142,5 +162,5 @@ int RGWAWSSyncModule::create_instance(CephContext *cct, map<string, string>& con
 
     // maybe we should just pass dictionaries around?
   instance->reset(new RGWAWSSyncModuleInstance(cct, s3_endpoint, access_key, secret));
-
+  return 0;
 }