}
}
};
+
+class RGWAWSHandleRemoteObjCR : public RGWCallStatRemoteObjCR {
+ const AWSConfig& conf;
+public:
+ RGWAWSHandleRemoteObjCR(RGWDataSyncEnv *_sync_env,
+ RGWBucketInfo& _bucket_info, rgw_obj_key& _key,
+ const AWSConfig& _conf) : RGWCallStatRemoteObjCR(_sync_env, _bucket_info, _key),
+ conf(_conf) {
+ }
+
+ ~RGWAWSHandleRemoteObjCR() {}
+
+ RGWStatRemoteObjCBCR *allocate_callback() override {
+ return new RGWAWSHandleRemoteObjCBCR(sync_env, bucket_info, key, conf);
+ }
+};
+
+
+class RGWAWSDataSyncModule: public RGWDataSyncModule {
+ AWSConfig conf;
+public:
+ RGWAWSDataSyncModule(CephContext *cct, const string& s3_endpoint, const string& access_key, const string& secret){
+ conf.id = string("s3:") + s3_endpoint;
+ // TODO: modify restconn class to accept user spec. keys
+ conf.conn = new RGWRESTConn(cct,
+ nullptr, // we don't need a rados store handle for this client
+ conf.id,
+ { s3_endpoint });
+ }
+
+ ~RGWAWSDataSyncModule() {
+ delete conf.conn;
+ }
+ RGWCoroutine *sync_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, uint64_t versioned_epoch) override {
+ ldout(sync_env->cct, 0) << conf.id << ": sync_object: b=" << bucket_info.bucket << " k=" << key << " versioned_epoch=" << versioned_epoch << dendl;
+ return new RGWAWSHandleRemoteObjCR(sync_env, bucket_info, key, conf);
+ }
+ RGWCoroutine *remove_object(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, real_time& mtime, bool versioned, uint64_t versioned_epoch) override {
+ ldout(sync_env->cct, 0) <<"AWS Not implemented: rm_object: b=" << bucket_info.bucket << " k=" << key << " mtime=" << mtime << " versioned=" << versioned << " versioned_epoch=" << versioned_epoch << dendl;
+ return NULL;
+ }
+ RGWCoroutine *create_delete_marker(RGWDataSyncEnv *sync_env, RGWBucketInfo& bucket_info, rgw_obj_key& key, real_time& mtime,
+ rgw_bucket_entry_owner& owner, bool versioned, uint64_t versioned_epoch) override {
+ ldout(sync_env->cct, 0) <<"AWS Not implemented: create_delete_marker: b=" << bucket_info.bucket << " k=" << key << " mtime=" << mtime
+ << " versioned=" << versioned << " versioned_epoch=" << versioned_epoch << dendl;
+ return NULL;
+ }
+};
+
+class RGWAWSSyncModuleInstance : public RGWSyncModuleInstance {
+ RGWAWSDataSyncModule data_handler;
+public:
+ RGWAWSSyncModuleInstance(CephContext *cct, const string& s3_endpoint, const string& access_key, const string& secret) : data_handler(cct, s3_endpoint, access_key, secret) {}
+ RGWDataSyncModule *get_data_handler() override {
+ return &data_handler;
+ }
+};
+
+int RGWAWSSyncModule::create_instance(CephContext *cct, map<string, string>& config, RGWSyncModuleInstanceRef *instance){
+ string s3_endpoint, access_key, secret;
+ auto i = config.find("s3_endpoint");
+ if (i != config.end())
+ s3_endpoint = i->second;
+
+ i = config.find("access_key");
+ if (i != config.end())
+ access_key = i->second;
+
+ i = config.find("secret");
+ if (i != config.end())
+ secret = i->second;
+
+ // maybe we should just pass dictionaries around?
+ instance->reset(new RGWAWSSyncModuleInstance(cct, s3_endpoint, access_key, secret));
+
+}