å€ãã®å Žåãããã¯éèŠã§ã¯ãããŸããã ãããçç±ãçµæãã¯ããããŸããããããŒãžã§ã³ç®¡çã·ã¹ãã ã¯äž»ã«æ¯èŒçå°ããªããã¹ããã¡ã€ã«ã®ä¿åã«äœ¿çšãããŸãã æã«ã¯ããã€ãã®åçãã©ã€ãã©ãªã
ãããžã§ã¯ãã§é«è§£å床ã®å€æ°ã®ç»åããµãŠã³ããã¡ã€ã«ããœãŒã¹ãã¡ã€ã«ãã°ã©ãã£ãã¯ã3DããããªããŸãã¯ãã®ä»ã®ãšãã£ã¿ãŒã䜿çšããŠããå Žåãããã¯åé¡ã§ãã éåžžããããã®ãã¡ã€ã«ã¯ãã¹ãŠãµã€ãºã倧ããããã€ããªã§ããã€ãŸããããŒãžã§ã³ç®¡çã·ã¹ãã ãšãã¹ãã£ã³ã°ãªããžããªã®ãã¹ãŠã®å©ç¹ãšäŸ¿å©ãã¯ãé¢é£ãããã¹ãŠã®ãµãŒãã¹ãšãšãã«å©çšã§ããªããªããŸãã
次ã«ãããŒãžã§ã³ç®¡çã·ã¹ãã ãšAmazon S3ïŒã¯ã©ãŠããã¡ã€ã«ã¹ãã¬ãŒãžïŒã®çµ±åäŸãèŠãŠãäž¡æ¹ã®ãœãªã¥ãŒã·ã§ã³ã掻çšããæ¬ ç¹ãè£ããŸãã
ãœãªã¥ãŒã·ã§ã³ã¯CïŒã§èšè¿°ãããŠãããAmazon Web Services APIã䜿çšããMercurialãªããžããªã®ã»ããã¢ããäŸã瀺ããŠããŸãã ã³ãŒãã¯éããŠããããªã³ã¯ã¯èšäºã®æåŸã«ãããŸãã ãã¹ãŠãå€ããå°ãªããã¢ãžã¥ãŒã«æ¹åŒã§èšè¿°ãããŠãããããAmazon S3以å€ã®ãµããŒããè¿œå ããããšã¯é£ãããããŸããã GITã®ã»ããã¢ãããåæ§ã«ç°¡åã«ãªããšæããŸãã
ã ãããããã¯ãã¹ãŠã¢ã€ãã¢ããå§ãŸããŸãã-ããŒãžã§ã³ç®¡çã·ã¹ãã ãšãªããžããªèªäœãšã®çµ±ååŸããŠãŒã¶ãŒããã®è¿œå ã®ã¢ã¯ã·ã§ã³ãå¿ èŠãšããã«å®å šã«æ°ä»ãããã«åäœããããã°ã©ã ãå¿ èŠã§ãã éæ³ã¿ããã
ããŒãžã§ã³ç®¡çã·ã¹ãã ãšã®çµ±åã¯ãããããããã¯ïŒç¬èªã®ãã³ãã©ãŒãå²ãåœãŠãããšãã§ããã€ãã³ãïŒã䜿çšããŠå®è£ ã§ããŸãã ããŒã¿ã®åä¿¡ãŸãã¯å¥ã®ãªããžããªãžã®éä¿¡æã«èµ·åããããã®ã«é¢å¿ããããŸãã Mercurialã«ã¯ãçä¿¡ããã³çºä¿¡ãšåŒã°ããå¿ èŠãªããã¯ããããŸãã ãããã£ãŠãã€ãã³ãããšã«1ã€ã®ã³ãã³ããå®è£ ããå¿ èŠããããŸãã 1ã€ã¯æŽæ°ãããããŒã¿ãäœæ¥ãã©ã«ããŒããã¯ã©ãŠãã«ããŠã³ããŒãããããã®ãã®ã§ããã1ã€ã¯ãªããŒã¹ããã»ã¹ã®ããã®ãã®ã§ããæŽæ°ãã¯ã©ãŠãããäœæ¥ãã©ã«ããŒã«ããŠã³ããŒãããããã®ãã®ã§ãã
ãªããžããªãšã®çµ±åã¯ãã¡ã¿ããŒã¿ãã¡ã€ã«ãŸãã¯ã€ã³ããã¯ã¹ãã¡ã€ã«ããŸãã¯ä»»æã®æ¹æ³ã䜿çšããŠå®è¡ãããŸãã ãã®ãã¡ã€ã«ã«ã¯ããã¹ãŠã®ç£èŠå¯Ÿè±¡ãã¡ã€ã«ã®èª¬æãå°ãªããšãããããžã®ãã¹ãå«ãŸããŠããå¿ èŠããããŸãã ãããŠããã®ç¹å®ã®ãã¡ã€ã«ã¯ããŒãžã§ã³ç®¡çäžã«çœ®ãããŸãã ç£èŠå¯Ÿè±¡ã®ãã¡ã€ã«èªäœã¯ãç¡èŠããããã¡ã€ã«ã®ãªã¹ãã§ãã.hgignoreã«ãããŸãããã以å€ã®å Žåããã®ãã³ãã£ãŒã®èŠç¹ã¯ãã¹ãŠæ¶ããŸãã
ãªããžããªçµ±å
ã¡ã¿ããŒã¿ãã¡ã€ã«ã¯æ¬¡ã®ããã«ãªããŸãã
<?xml version="1.0" encoding="utf-8"?> <assets> <locations> <location>Content\Textures</location> <location>Content\Sounds</location> <location searchPattern="*.pdf">Docs</location> <location>Reference Libraries</location> </locations> <amazonS3> <accesskey>*****************</accesskey> <secretkey>****************************************</secretkey> <bucketname>mybucket</bucketname> </amazonS3> <files> <file path="Content\Textures\texture1.dds" checksum="BEF94D34F75D2190FF98746D3E73308B1A48ED241B857FFF8F9B642E7BB0322A"/> <file path="Content\Textures\texture1.psd" checksum="743391C2C73684AFE8CEB4A60B0317E634B6E54403E018385A85F048CC5925DE"/> <!-- --> </files> </assets>
ãã®ãã¡ã€ã«ã«ã¯ãå ŽæãamazonS3ãããã³ãã¡ã€ã«ã®3ã€ã®ã»ã¯ã·ã§ã³ããããŸãã æåã®2ã€ã¯ãŠãŒã¶ãŒãæåã«èšå®ããæåŸã®2ã€ã¯ããã°ã©ã èªäœããã¡ã€ã«èªäœã远跡ããããã«äœ¿çšããŸãã
å Žæã¯ã远跡ãã¡ã€ã«ãæ€çŽ¢ããããã¹ã§ãã ãããã¯ã絶察ãã¹ãŸãã¯ãã®xmlèšå®ãã¡ã€ã«ãžã®çžå¯Ÿãã¹ã§ãã ããŒãžã§ã³ç®¡çã·ã¹ãã ã®ç¡èŠãã¡ã€ã«ã«åããã¹ãè¿œå ããŠãããèªäœããããã远跡ããããšããªãããã«ããå¿ èŠããããŸãã
AmazonS3ã¯ããæ³åã®ãšãããã¯ã©ãŠããã¡ã€ã«ã¹ãã¬ãŒãžèšå®ã§ãã æåã®2ã€ã®ããŒã¯ã¢ã¯ã»ã¹ããŒã§ãAWSãŠãŒã¶ãŒçšã«çæã§ããŸãã Amazon APIãªã¯ãšã¹ãã«æå·ã§çœ²åããããã«äœ¿çšãããŸãã Bucketnameã¯ãã±ããã®ååã§ãããã±ããã¯ããã¡ã€ã«ãšãã©ã«ããŒãå«ããããšãã§ããç£èŠå¯Ÿè±¡ãã¡ã€ã«ã®ãã¹ãŠã®ããŒãžã§ã³ãä¿åããããã«äœ¿çšãããAmazon S3å ã®ãšã³ãã£ãã£ã§ãã
ãã®ã»ã¯ã·ã§ã³ã¯ããªããžããªã§ã®äœæ¥äžã«ããã°ã©ã èªäœã«ãã£ãŠç·šéãããããããã¡ã€ã«ãæ§æããå¿ èŠã¯ãããŸããã çŸåšã®ããŒãžã§ã³ã®ãã¹ãŠã®ãã¡ã€ã«ã®ãªã¹ããšãã¹ãšããã·ã¥ãå«ãŸããŸãã ãããã£ãŠãpullãšäžç·ã«ãã®xmlãã¡ã€ã«ã®æ°ããããŒãžã§ã³ãååŸããFilesã»ã¯ã·ã§ã³ã®å 容ãç£èŠå¯Ÿè±¡ãã©ã«ããŒèªäœã®å 容ãšæ¯èŒãããšãã©ã®ãã¡ã€ã«ãè¿œå ãããã©ã®ãã¡ã€ã«ãå€æŽãããã©ã®ãã¡ã€ã«ãåã«ç§»åãŸãã¯ååå€æŽãããããç解ã§ããŸãã ããã·ã¥äžãæ¯èŒã¯å察æ¹åã«å®è¡ãããŸãã
ããŒãžã§ã³ç®¡çã·ã¹ãã ãšã®çµ±å
ããŒã èªäœã«ã€ããŠã§ãã ãã®ããã°ã©ã ã¯ãããã·ã¥ããã«ãã¹ããŒã¿ã¹ã®3ã€ã®ã³ãã³ãããµããŒãããŠããŸãã æåã®2ã€ã¯ã察å¿ããããã¯ãèšå®ããããã®ãã®ã§ãã ã¹ããŒã¿ã¹ã¯ãç£èŠå¯Ÿè±¡ãã¡ã€ã«ã«é¢ããæ å ±ã衚瀺ãããã®åºåã¯hg statusã®åºåã«äŒŒãŠããŸã-ã©ã®ãã¡ã€ã«ãäœæ¥ãã©ã«ããŒã«è¿œå ãããå€æŽã移åãããã©ã®ãã¡ã€ã«ãããã«ãªãããç解ããããã«äœ¿çšã§ããŸãã
pushã³ãã³ãã¯æ¬¡ã®ããã«æ©èœããŸãã æåã«ãxmlãã¡ã€ã«ããã¹ãããã³ããã·ã¥ããç£èŠå¯Ÿè±¡ãã¡ã€ã«ã®ãªã¹ããååŸããŸãã ããã¯ããªããžããªã«èšé²ãããæåŸã®ç¶æ ã«ãªããŸãã 次ã«ãäœæ¥ãã©ã«ããŒã®çŸåšã®ç¶æ ã«é¢ããæ å ±ïŒãã¹ãŠã®ç£èŠå¯Ÿè±¡ãã¡ã€ã«ã®ãã¹ãšããã·ã¥ïŒãåéãããŸãã ããã¯ãäž¡æ¹ã®ãªã¹ãã®æ¯èŒã§ãã
4ã€ã®ç°ãªãç¶æ³ããããŸãã
- äœæ¥ãã©ã«ããŒã«ã¯æ°ãããã¡ã€ã«ãå«ãŸããŠããŸãã ããã¯ããã¹ãŸãã¯ããã·ã¥ã«ãã£ãŠäžèŽãããã®ããªãå Žåã«çºçããŸãã ãã®çµæãxmlãã¡ã€ã«ãæŽæ°ãããæ°ãããã¡ã€ã«ã«é¢ããã¬ã³ãŒããè¿œå ããããã¡ã€ã«èªäœãS3ã«ã¢ããããŒããããŸãã
- äœæ¥ãã©ã«ããŒã«ã¯ãå€æŽããããã¡ã€ã«ãå«ãŸããŠããŸãã ããã¯ããã¹ã«æ²¿ã£ãŠäžèŽããããããã·ã¥äžèŽããªãå Žåã«çºçããŸãã ãã®çµæãxmlãã¡ã€ã«ãæŽæ°ããã察å¿ããã¬ã³ãŒãã®ããã·ã¥ãå€æŽããããã¡ã€ã«ã®æŽæ°ãããããŒãžã§ã³ãS3ã«ããŒããããŸãã
- äœæ¥ãã©ã«ããŒã«ã¯ã移åãŸãã¯ååå€æŽããããã¡ã€ã«ãå«ãŸããŸãã ããã¯ãããã·ã¥ã®äžèŽãããå Žåã«çºçããŸãããéäžã§äžèŽãããã®ã¯ãããŸããã ãã®çµæãxmlãã¡ã€ã«ãæŽæ°ããã察å¿ããã¬ã³ãŒãã®ãã¹ãå€æŽãããS3ã«äœãããŒãããå¿ èŠããããŸããã å®éã®ãšãããS3ã«ãã¡ã€ã«ãä¿åããããã®ããŒã¯ããã·ã¥ã§ããããã¹æ å ±ã¯xmlãã¡ã€ã«ã«ã®ã¿èšé²ãããŸãã ãã®å Žåãããã·ã¥ã¯å€æŽãããŠããªããããS3ã§åããã¡ã€ã«ããªããŒãããŠãæå³ããããŸããã
- 远跡ããããã¡ã€ã«ã¯ãäœæ¥ãã©ã«ããŒããåé€ãããŸãã ããã¯ãxmlãã¡ã€ã«ã®ãšã³ããªã®ãããããããŒã«ã«ãã¡ã€ã«ã®ããããšãäžèŽããªãå Žåã«çºçããŸãã ãã®çµæããã®ãšã³ããªã¯xmlãã¡ã€ã«ããåé€ãããŸãã S3ã®äž»ãªç®çã¯ããã¹ãŠã®ããŒãžã§ã³ã®ãã¡ã€ã«ãä¿åããŠãä»»æã®ãªããžã§ã³ã«ããŒã«ããã¯ã§ããããã«ããããšã§ãããããS3ããäœãåé€ãããŸããã
èãããã5çªç®ã®ç¶æ³ããããŸã-ãã¡ã€ã«ã¯å€æŽãããŠããŸããã ããã¯ããã¹ãšããã·ã¥ã®äž¡æ¹ã«äžèŽããå Žåã«çºçããŸãã ãã®ç¶æ³ã§ã¯ãã¢ã¯ã·ã§ã³ã¯äžèŠã§ãã
pullã³ãã³ãã¯ãxmlã®ãã¡ã€ã«ã®ãªã¹ããããŒã«ã«ãã¡ã€ã«ã®ãªã¹ããšæ¯èŒãããŸã£ããåãããã«æ©èœããŸãããå察æ¹åã«ã®ã¿æ©èœããŸãã ããšãã°ãxmlã«æ°ãããã¡ã€ã«ã«é¢ãããšã³ããªãå«ãŸããŠããå Žåãã€ãŸãããã¹ã«ãããã·ã¥ã«ãäžèŽããªãå Žåããã®ãã¡ã€ã«ã¯S3ããããŠã³ããŒããããæå®ããããã¹ã«ããŒã«ã«ã«æžã蟌ãŸããŸãã
ããã¯ãæ§æãããhgrcã®äŸïŒ
[hooks] postupdate = \path\to\assets.exe pull \path\to\assets.config \path\to\checksum.cache prepush = \path\to\assets.exe push \path\to\assets.config \path\to\checksum.cache
ããã·ã³ã°
S3ãžã®ã¢ããŒã«ã¯æå°éã«æããããŸãã GetObjectãšPutObjectã®2ã€ã®ã³ãã³ãã®ã¿ã䜿çšãããŸãã ãã¡ã€ã«ã¯ãæ°ãããã¡ã€ã«ãŸãã¯å€æŽããããã¡ã€ã«ã§ããå Žåã«ã®ã¿ãS3ããããŠã³ããŒãããã³ããŠã³ããŒããããŸãã ããã¯ããã¡ã€ã«ããã·ã¥ãããŒãšããŠäœ¿çšããããšã§å¯èœã§ãã ã€ãŸããç©ççã«ãã¹ãŠã®ãã¡ã€ã«ã®ãã¹ãŠã®ããŒãžã§ã³ããéå±€ããã©ã«ããŒããŸã£ãããªãS3ãã±ããã«ãããŸãã æãããªãã€ãã¹-è¡çªããããŸãã 2ã€ã®ãã¡ã€ã«ã®ããã·ã¥ãåãå Žåããã®ãã¡ã®1ã€ã«é¢ããæ å ±ã¯S3ã«èšé²ãããŸããã
ããã·ã¥ãããŒãšããŠäœ¿çšããããšã®å©äŸ¿æ§ã¯ãæœåšçãªå±éºãããéèŠãªã®ã§ãããããæŸæ£ããããããŸããã è¡çªã®å¯èœæ§ãã§ããã ãèæ ®ã«å ¥ãããããå¯èœãªéãæžãããçµæãããã»ã©èŽåœçã§ã¯ãªãããã«ããããšã ããå¿ èŠã§ãã
確çãæžããã«ã¯éåžžã«ç°¡åã§ã-ããé·ãããŒãæã€ããã·ã¥é¢æ°ã䜿çšããå¿ èŠããããŸãã ç§ã®å®è£ ã§ã¯ãSHA256ã䜿çšããŸããããããã§ååã§ãã ãã ããããã¯ãŸã è¡çªã®å¯èœæ§ãæé€ããŸããã å€æŽãè¡ãåã«ãããããå®çŸ©ã§ããå¿ èŠããããŸãã
ãããé£ããããšã§ã¯ãããŸããã ãã¹ãŠã®ããŒã«ã«ãã¡ã€ã«ã¯ãããã·ã¥ã³ãã³ããšãã«ã³ãã³ããå®è¡ããåã«æ¢ã«ããã·ã¥ãããŠããŸãã ããã·ã¥éã«äžèŽããããã©ããã確èªããã ãã§ãã ãªããžããªã§è¡çªãä¿®æ£ãããªãããã«ãããã·ã¥äžã«ãã§ãã¯ãè¡ãã ãã§ååã§ãã è¡çªãæ€åºããããšããŠãŒã¶ãŒã«ãã®åé¡ãéç¥ããã2ã€ã®ãã¡ã€ã«ã®ãããããå€æŽããŠããäžåºŠããã·ã¥ããããã«æ±ããããŸãã ãã®ãããªç¶æ³ã®å¯èœæ§ãäœãããšãèãããšããã®ãœãªã¥ãŒã·ã§ã³ã¯æºè¶³ã®ãããã®ã§ãã
æé©å
ãã®ãããªããã°ã©ã ã«ã¯ãå³å¯ãªããã©ãŒãã³ã¹èŠä»¶ã¯ãããŸããã 1ã5ç§éæ©èœããŸãããããã»ã©éèŠã§ã¯ãããŸããã ãã ããèæ ®ããããšãã§ããããã³èæ ®ãã¹ãæãããªå ŽæããããŸãã ãããŠããããæãæçœãªã®ã¯ããã·ã¥ã§ãã
éžæããã¢ãããŒãã§ã¯ãå®è¡æã«ãã¹ãŠã®ã³ãã³ããç£èŠå¯Ÿè±¡ãã¡ã€ã«ãã¹ãŠã®ããã·ã¥ãèšç®ããå¿ èŠããããšæ³å®ããŠããŸãã ãã¡ã€ã«ãæ°åã®å ŽåããŸãã¯ãã¡ã€ã«ã®åèšãµã€ãºã1ã®ã¬ãã€ããè¶ ããå Žåããã®æäœã«ã¯1å以äžãããããšããããŸãã 1åéã®ããã·ã¥ã®èšç®ã¯èš±ãããªãã»ã©é·ãã§ãã
ãªããžããªã®äžè¬çãªäœ¿çšã§ã¯ãããã·ã¥ã®çŽåã«ãã¹ãŠã®ãã¡ã€ã«ãå€æŽããå¿ èŠããªãããšã«æ°ã¥ããå Žåããœãªã¥ãŒã·ã§ã³ã¯æããã«ãªããŸã-ãã£ãã·ã³ã°ã ç§ã®å®è£ ã§ã¯ããã€ãã§åºåããããã¡ã€ã«ã䜿çšããããšã«æ±ºããŸããããã®ãã¡ã€ã«ã¯ããã°ã©ã ã®é£ã«ããã以åã«èšç®ããããã¹ãŠã®ããã·ã¥ã«é¢ããæ å ±ãå«ã¿ãŸãã
| |
ãã®ãã¡ã€ã«ã¯ãã³ãã³ããå®è¡ãããåã«ããŒããããããã»ã¹ã§äœ¿çšãããã³ãã³ãã®å®è¡åŸã«æŽæ°ããã³ä¿åãããŸãã ãããã£ãŠãlogo.jpgãã¡ã€ã«ã®ããã·ã¥ã1æ¥åã«æåŸã«èšç®ããããã¡ã€ã«èªäœã3æ¥åã«æåŸã«å€æŽãããå Žåããã®ããã·ã¥ãåèšç®ããæå³ã¯ãããŸããã
æé©åã¯ãå ã®FileStreamã®ä»£ããã«BufferedStreamã䜿çšããŠãããã·ã¥ãèšç®ããèªã¿åããå«ããã¡ã€ã«ãèªã¿åãããã®ã¹ãã¬ãããšåŒã°ããããšããããŸãã ãã¹ãã§ã¯ãåèšãµã€ãºã1ã®ã¬ãã€ããè¶ ãã1äžåã®ãã¡ã€ã«ã®ããã·ã¥ãèšç®ããããã«ããããã¡ãŒãµã€ãºã1ã¡ã¬ãã€ãïŒFileStram 8ãããã€ãã®ä»£ããïŒã®BufferedStreamã䜿çšãããšãæšæºHDDã®FileStreamã«æ¯ã¹ãŠããã»ã¹ã4åéããªãããšã瀺ãããŸããã ãã¡ã€ã«ãããã»ã©å€ããªãããã¡ã€ã«èªäœã1ã¡ã¬ãã€ããã倧ããå Žåããã®å·®ã¯ããã»ã©å€§ãããªããçŽ5ã10ããŒã»ã³ãã«ãªããŸãã
Amazon s3
ããã§ã¯ã2ã€ã®ãã€ã³ããæ確ã«ãã䟡å€ããããŸãã æãéèŠãªããšã¯ãããããåé¡ã®äŸ¡æ Œã§ãã ãåç¥ã®ããã«ãæ°ãããŠãŒã¶ãŒã®å Žåãå¶éãè¶ ããªããã°æåã®1幎éã®äœ¿çšã¯ç¡æã§ãã å¶éã¯æ¬¡ã®ãšããã§ãã5ã®ã¬ãã€ãã1ãæããã20,000ã®GetObjectèŠæ±ã1ãæããã2,000ã®PutObjectèŠæ±ã å šé¡ãæ¯æããšã1ãæã§çŽ1ãã«ã®äŸ¡å€ããããŸãã ãã®ããã«ãå°åå ã®ããã€ãã®ããŒã¿ã»ã³ã¿ãŒã®äºçŽãšé«éãååŸããŸãã
ãŸããèªè ãæåãã次ã®è³ªåã«èŠãããããŠããããšãæ¢ããŠç€ºåããŸããDropboxãããå Žåããªããã®ãã€ã¯ãªã®ã§ããããã å®éã«ã¯ãDropboxãçŽæ¥ã³ã©ãã¬ãŒã·ã§ã³ã«äœ¿çšããã®ã¯é¢åã§ã-競åã«ãŸã£ãã察åŠããŸããã
ããããçŽæ¥äœ¿çšããªãå Žåã¯ã©ããªããŸããïŒ å®éãäžèšã®ãœãªã¥ãŒã·ã§ã³ã§ã¯ãAmazon S3ãåãDropboxãSkydriveãBitTorrent SyncãŸãã¯ä»ã®ã¢ããã°ã«ç°¡åã«çœ®ãæããããšãã§ããŸãã ãã®å Žåããããã¯ãã¡ã€ã«ã®ãã¹ãŠã®ããŒãžã§ã³ã®ãªããžããªãšããŠæ©èœããããã·ã¥ã¯ãã¡ã€ã«åãšããŠäœ¿çšãããŸãã ç§ã®ãœãªã¥ãŒã·ã§ã³ã§ã¯ãããã¯AmazonS3RemoteStorageã®é¡äŒŒç©ã§ããFileSystemRemoteStorageãéããŠå®è£ ãããŠããŸãã
çŽæã®ãœãŒã¹ãªã³ã¯ïŒ bitbucket.org/openminded/assetsmanager