码迷,mamicode.com
首页 > 其他好文 > 详细

s3 IO路径分析

时间:2020-11-21 12:28:04      阅读:7      评论:0      收藏:0      [点我收藏+]

标签:close   name   hid   rgb   object   string   sed   null   end   

 

 

位置:rgw / rgw_rest.cc 2523

技术图片
 1 RGWHandler_REST *RGWREST::get_handler(rgw::sal::RGWRadosStore *const store,
 2                                       struct req_state *const s,
 3                                       const rgw::auth::StrategyRegistry &auth_registry,
 4                                       const std::string &frontend_prefix,
 5                                       RGWRestfulIO *const rio,
 6                                       RGWRESTMgr **const pmgr,
 7                                       int *const init_error)
 8 {
 9   *init_error = preprocess(s, rio);
10   if (*init_error < 0)
11   {
12     return nullptr;
13   }
14   RGWRESTMgr *m = mgr.get_manager(s, frontend_prefix, s->decoded_uri, &s->relative_uri);
15   if (!m)
16   {
17     *init_error = -ERR_METHOD_NOT_ALLOWED;
18     return nullptr;
19   }
20   if (pmgr)
21   {
22     *pmgr = m;
23   }
24 
25   RGWHandler_REST *handler = m->get_handler(store, s, auth_registry, frontend_prefix);
26   if (!handler)
27   {
28     *init_error = -ERR_METHOD_NOT_ALLOWED;
29     return NULL;
30   }
31   *init_error = handler->init(store, s, rio);
32   if (*init_error < 0)
33   {
34     m->put_handler(handler);
35     return nullptr;
36   }
37   return handler;
38 } 
View Code

 

位置:rgw / rgw_rest_s3.cc
 RGWHandler_REST *handler = m->get_handler(store, s, auth_registry, frontend_prefix); 

技术图片
 1 RGWHandler_REST *RGWRESTMgr_S3::get_handler(rgw::sal::RGWRadosStore *store, struct req_state *const s,
 2                                            const rgw::auth::StrategyRegistry &auth_registry, const std::string &frontend_prefix)
 3 {
 4   bool is_s3website = enable_s3website && (s->prot_flags & RGW_REST_WEBSITE);
 5   int ret = RGWHandler_REST_S3::init_from_header(store, s, is_s3website ? RGW_FORMAT_HTML : RGW_FORMAT_XML, true);
 6   if (ret < 0)
 7     return NULL;
 8 
 9   RGWHandler_REST *handler;
10   if (is_s3website) // 基于html的handler
11   {
12     // 根据请求中操作对象的不同返回不同的handler
13     if (s->init_state.url_bucket.empty())
14     {
15       handler = new RGWHandler_REST_Service_S3Website(auth_registry);
16     }
17     else if (rgw::sal::RGWObject::empty(s->object.get()))
18     {
19       handler = new RGWHandler_REST_Bucket_S3Website(auth_registry);
20     }
21     else
22     {
23       handler = new RGWHandler_REST_Obj_S3Website(auth_registry);
24     }
25   }
26   else //基于xml的handler
27   {
28     // 根据请求中操作对象的不同返回不同的handler
29     if (s->init_state.url_bucket.empty())
30     {
31       handler = new RGWHandler_REST_Service_S3(auth_registry, enable_sts, enable_iam, enable_pubsub);
32     }
33     else if (rgw::sal::RGWObject::empty(s->object.get()))
34     {
35       handler = new RGWHandler_REST_Bucket_S3(auth_registry, enable_pubsub);
36     }
37     else
38     {
39       handler = new RGWHandler_REST_Obj_S3(auth_registry);
40     }
41   }
42   ldpp_dout(s, 20) << __func__ << " handler=" << typeid(*handler).name() << dendl;
43   return handler;
44 }
View Code

 

s3 IO路径分析

标签:close   name   hid   rgb   object   string   sed   null   end   

原文地址:https://www.cnblogs.com/sunbin01/p/13995767.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!