s3 IO路径分析
Posted sunbin01
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了s3 IO路径分析相关的知识,希望对你有一定的参考价值。
位置: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 }
位置: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 }
以上是关于s3 IO路径分析的主要内容,如果未能解决你的问题,请参考以下文章
java内存流:java.io.ByteArrayInputStreamjava.io.ByteArrayOutputStreamjava.io.CharArrayReaderjava.io(代码片段
java缓冲字符字节输入输出流:java.io.BufferedReaderjava.io.BufferedWriterjava.io.BufferedInputStreamjava.io.(代码片段