facebook架构设计中文

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

6FacebookDaveFettermanFredBrooks,TheMythicalMan-Month6.1FredBrooksWebWebQuickSortWebnFacebookFacebookFacebook√√√√√√√√FacebooknFacebookFacebookFacebookFacebookFacebookFacebooknWebFacebookFacebookAPIFacebookFQLFacebookFBMLFacebookFacebook••WebFacebookAPI•Web•WebFacebookFQL•FacebookFacebookFBML•FacebookWebWebFacebookFacebook1106WebFacebook://fettermansbooks.comFlashAJAX{title,author,publisher,price,coverpicture}book_get_reviews:isbn-set(review_ids)bookuser_get_reviews:books_user_id-set(review_ids)review_get_info:review_id-{isbn,books_user_id,rating,commentary}6-26-2search_title_string:title_string-set({isbn,relevancescore})=XISBNY=Y111:uid-set(uids)user_get_info:uid-{name,pic,books,current_location,...}can_see:{uid_viewer,uid_viewee,table_name,field_name}-0or1uidFacebookuser_get_infoinfoFacebookusers.getInfo://fettermansbooks.comFacebook://fettermansbooks.com://fettermansbooks.com113AppSQLAppAppFBFBFBFBAppFacebookWebFacebook•FacebookWeb•FBML•FBMLFacebookcookieFacebookJavaScriptFBJS•FacebookFacebook6.2Web=establish_booksite_userid($_REQUEST);$book_infos=user_get_likely_books($books_user_id);display_books($book_infos);11466-2WebFacebookuser_get_likely_booksFacebookRPC•friends.get()•users.getInfo($users,$fields)=establish_booksite_userid($_REQUEST);$facebook_client=establish_facebook_session($_REQUEST,$books_user_id);if($facebook_client){$facebook_friend_uids=$facebook_client-api_client-friends_get();foreach($facebook_friend_uidsas$facebook_friend){$book_site_friends[$facebook_friend]115FBAppFBSQLAppAppFBApp=books_user_id_from_facebook_id($facebook_friend);}$book_site_friend_names=$facebook-api_client-users_getInfo($facebook_friend_uids,'name');foreach($book_site_friendsas$fb_id=$booksite_id){$friend_books=user_get_reviewed_books($booksite_id);printhr.$book_site_friend_names[$fb_id].'slikelypicks:br;display_books($friend_books);}}Facebookestablish_facebook_sessionFacebookAPIWebFacebookThriftWebFacebookFacebookFacebookAPI6.2.1XMLWebfriends.getusers.getInfoFacebookFacebook6-66-6functionfriends_get($session_user){...}functionusers_getInfo($session_user,$input_users,$input_fields){...}WebHTTPGETPOSTXMLFacebookHTTPapikey-key6.2.2key://developers.facebook.com/thrift6-71.0API.thriftThriftAPI6-7ThriftWebxsd_namespace****Definitionoftypesavailableinapi.facebook.comversion1.0*/typedefi32uidtypedefstringuid_listtypedefstringfield_liststructlocation{1:stringstreetxsd_optional,2:stringcity,3:stringstate,4:stringcountry,5:stringzipxsd_optional}structuser{1:uiduid,2:stringname,3:stringbooks,4:stringpics,5:locationcurrent_location}serviceFacebookApi10{listuidfriends_get()throws(1:FacebookApiExceptionerror_response),117listuserusers_getInfo(1:uid_listuids,2:field_listfields)throws(1:FacebookApiExceptionerror_response),}stringlocationuserlistuid6-8PHP6-8Thriftclassapi10_user{public$uid=null;public$name=null;public$books=null;public$pic=null;public$current_location=null;publicfunction__construct($vals=null){if(is_array($vals)){if(isset($vals['uid])){$this-uid=$vals['uid'];}if(isset($vals['name'])){$this-name=$vals['name'];}if(isset($vals['books'])){$this-books=$vals['books'];}if(isset($vals['pic'])){$this-pic=$vals['pic'];}if(isset($vals['current_location'])){$this-current_location=$vals['current_location'];}//...}//...}user6-96-9returnnewapi_10_user($field_vals);current_location$field_vals['current_location']6-9newapi_10_user(...)XMLschemaXMLSchemaXSD6-10RPCXML11866-10WebXMLusers_getInfo_responselist=trueuserstype=listusernameDaveFetterman/namebooksZenandtheArt,TheBrothersK,RoaldDahl/bookspic/piccurrent_locationcitySanFrancisco/citystateCA/statezip94110/zip/current_location/user/users/users_getInfo_responseThriftRPCXML-RPCSOAPCPUThriftuserfavorite_recordsuidi64XMLRPCThriftThriftXMLSchemaXMLJSONPHPJavaC++PythonRubyC#Facebook1196.2.2WebFacebookFacebookFacebookFacebook6-1coo

1 / 39
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功