æå°æ½è±¡ãã¡ã¤ã«ã·ã¹ãã ã®ä»æ§æ¡ãæåã«åºããã®ã¯ã6æ3æ¥ãæå°æ½è±¡ãã¡ã¤ã«ã·ã¹ãã ã®ä»æ§æ¡ãã§ãã»ã¼åºã¾ã£ãã®ã7æ7æ¥ãæå°æ½è±¡ãã¡ã¤ã«ã·ã¹ãã ãããããå®è£ ãã§ãããã®ããã ã®å¤æ´ã¯ä»¥å¤ã«å°ãªãã¦ã次ã®ã¡ã¿ãã¼ã¿å¨ãã®äºé ã§ãã
- ãã¡ã¤ã«ã¡ã¿ãã¼ã¿ã¨ãã£ã¬ã¯ããªã¡ã¿ãã¼ã¿ãéç´ãã¦1種é¡ã«ããã
- ã¡ã¿ãã¼ã¿é ç®ãããreadOnlyã¨hiddenãè½ã¨ããã
- ã¡ã¿ãã¼ã¿æä½APIãè½ã¨ããã
ä¸æ¹ãCatyã®ã³ãã³ãè¨è¿°ã®ããã®æ§æã試æ¡ãã§ãã¾ãããããã§ãæå°æ½è±¡ãã¡ã¤ã«ã·ã¹ãã ã®APIãã³ãã³ã宣è¨ã®å½¢å¼ã§æ¸ãã¦ã¿ã¾ããAPIã¯ã³ãã³ãã»ãããããªããã©ãæå³çã«ã¯åããããªããã§ãã
/** æå°æ½è±¡ãã¡ã¤ã«ã·ã¹ãã ã®ä»æ§ * åã¨ã³ãã³ãï¼é¢æ°ï¼ */ module caty.mafs provides type // å ±éã®å [TimeStamp, Binary] provides type // åºæã®å [Path, AuthoriToken, Metadata, DirectoryEntry, DirectoryEntryList] privides command // èªã¿åãç¨ [readFile, readDirectory, getMetadata] privides command // æ¸ãè¾¼ã¿ï¼å¤æ´ç¨ [createFile, createDirectory, // çæ deleteFile, deleteDirectory, delete, // åé¤ writeFile // æ´æ°ï¼æ¸ã込㿠] ; /* * åã®å®ç¾© */ /** ã¿ã¤ã ã¹ã¿ã³ã */ type TimeStamp = opaque; /** ãã¤ããªãã¼ã¿ */ type Binary = opaque; /** mafsã®ãã¹ * http://d.hatena.ne.jp/m-hiyama/20090608/1244419502 ãåç § */ type Path = string(remark = "mafsã®ãã¹"); /** èªå¯ãã¼ã¯ã³ï¼ã¢ã¯ã»ã¹æ¨©é */ type AuthoriToken = opaque; /** ãã¡ã¤ã«ã¨ãã£ã¬ã¯ããªã®ã¡ã¿ãã¼ã¿ */ type Metadata = object { /** å 容ã®ãã¤ããµã¤ãº */ "contentLength" : integer(minimum = 0), /** å 容ã®ã¡ãã£ã¢ã¿ã¤ã * @default "application/octet-stream" */ "contentType" : string(remark = "MIMEã¿ã¤ã")?, /** ãã¡ã¤ã«ãä½ãããæ * çç¥ãããã¨ä¸æãæå³ãã */ "created" : TimeStamp?, /** ãã¡ã¤ã«ãæå¾ã«å¤æ´ãããæ */ "lastModified" : TimeStamp, /** å 容ãããã¹ããã¼ã¿ãã©ãã * @default false */ "isText" : boolean?, /** å 容ãããã¹ãã®ã¨ãããã®æåã¨ã³ã³ã¼ãã£ã³ã°ã¹ãã¼ã * @default "utf-8" */ "textEncoding" : string(remark = "æåã¨ã³ã³ã¼ãã£ã³ã°ã¹ãã¼ã ")?, /** å®è¡å¯è½ãã¡ã¤ã«ãã©ãã * @default false */ "executable" : boolean? }; /** ãã£ã¬ã¯ããªã¨ã³ããªã¼ */ type DirectoryEntry = object { /** ãã£ã¤ã«ã®ãã¼ã¹å */ "name" : string(remark = "ãã¡ã¤ã«ã®ãã¼ã¹å"), /** ãã¡ã¤ã«ï¼ãã£ã¬ã¯ããªã®ã¡ã¿ãã¼ã¿ */ "metadata" : Metadata }; type DirectoryEntryList = array [ DirectoryEntry* ]; /* * ã³ãã³ãï¼å®éã¯é¢æ°ã ãã©ï¼ * ä¾å¤ã®è¨è¿°ã¯çç¥ */ /* * èªã¿åãç¨ */ /** ãã¹ã§æå®ããããã¡ã¤ã«ã®å 容ãèªã */ command readFile [AuthoriToken, Path] :: void -> Binary; /** ãã¹ã§æå®ããããã£ã¬ã¯ããªã®å 容ãèªã */ command readDirectory [AuthoriToken, Path] :: void -> DirectoryEntryList; /** ãã¹ã§æå®ããããã¡ã¤ã«ï¼ãã£ã¬ã¯ããªã®ã¡ã¿ãã¼ã¿ãåå¾ */ command getMetadata [AuthoriToken, Path] :: void -> Metadata; /* * æ¸ãè¾¼ã¿ï¼å¤æ´ç¨ */ /** ãã¹ã§æå®ããããã¡ã¤ã«ãæ°è¦ä½æ */ command createFile [AuthoriToken, Path] :: void -> void; /** ãã¹ã§æå®ããããã£ã¬ã¯ããªãæ°è¦ä½æ */ command createDirectory [AuthoriToken, Path] :: void -> void; /** ãã¹ã§æå®ããããã¡ã¤ã«ãåé¤ */ command deleteFile [AuthoriToken, Path] :: void -> void; /** ãã¹ã§æå®ããããã£ã¬ã¯ããªãåé¤ */ command deleteDirectory [AuthoriToken, Path] :: void -> void; /** ãã¹ã§æå®ããããã¡ã¤ã«ï¼ãã£ã¬ã¯ããªãåé¤ */ command delete [AuthoriToken, Path] :: void -> void; /** ãã¹ã§æå®ããããã¡ã¤ã«ã®å 容ãä¸æ¸ããã */ command writeFile [AuthoriToken, Path, Binary] :: void -> void;
ã¡ãã£ã¨ææ³ãæ¸ãã¾ããmafsã«é¢ããææ³ãããªãã¦ãåå®ç¾©ï¼ã³ãã³ã宣è¨æ§æã«é¢ããææ³ã
- é é¨ï¼ã¢ã¸ã¥ã¼ã«å®£è¨æï¼ã®æ§æã¯ããããªæ±ºãã¦ãªãã£ãã®ã§ããããããªæãã§ãããã
- TimeStampåã¨Binaryåã¯ãcaty.mafs以å¤ã®ãã£ã¨ä¸è¬çãªã¢ã¸ã¥ã¼ã«ã§å®ç¾©ãããã¹ãã§ããããcaty.mafs:Binaryãããcaty:Binaryããããã¯åã«Binaryãèªç¶ã§ãããã
- ã/**ãã¯ããã¥ã¡ã³ãã¼ã·ã§ã³ã³ã¡ã³ãã®éå§ã§ããããã¥ã¡ã³ãã¼ã·ã§ã³ã³ã¡ã³ãã¯ãç´å¾ã®æ§æè¦ç´ ã«é¢ä¿ã¥ãããã¾ããjavadocãEDocã¨ä¼¼ããã¼ã«ãå¿ è¦ã§ãã
- ããã¥ã¡ã³ãã¼ã·ã§ã³ã³ã¡ã³ãå ã¯ããã¬ã¼ã³ããã¹ããã¾ãã¯Creole wikiæ§æã§ããããªãã¨æã£ã¦ã¾ãããã¹ãã¼ãå ã§ããã©ã«ãå¤ãæ¸ããªãã®ã§ã@default ã¨ã使ã£ã¦ã¿ã¾ãããã¢ãããã¼ã¯ã¿ã°ãã»ãã¨ã«ãµãã¼ããããã©ããã¯æªå®ã§ãã
- ã詮索ã¯ä¸è¦ãä¸èº«ãè¦ããªãã¨ããæå³ã§ opaque ã¨ãããã¼ã¯ã¼ããä»ã足ãã¾ãããããã¬ãã«ã®ã¢ããªã±ã¼ã·ã§ã³ã«ã¨ã£ã¦è©³ç´°ãä¸è¦ãªã¨ãã«ãããã¯å¿ è¦ã§ããã
- opaqueã¯ããã¼ã¿ã®æ§é ã«é¢ããæ å ±ãæå³çã«æä¾ããªãã®ã§ããããã¾ã å®ç¾©ãã¦ãªããã¨ãããã¨ã表ãdeferredãã¼ã¯ã¼ããå¿ è¦ã§ãããã
- 空ãªãªãã·ã§ã³{}ã空ãªãã¬ã¼ã³å¼æ°[]ã¯ããã£ã±ãçç¥ã§ããã»ããããã§ããã
- ä¸ã®ä¾ã§ã¯ä½¿ã£ã¦ã¾ããããAPIè¨è¿°ã§ä½¿ãã«ã¯ã¢ããã¼ã·ã§ã³ãå¿ è¦ããã§ããä¾ãã°ãèªã¿åãé¢æ°ã«ã¯ @readerãæ´æ°é¢æ°ã«ã¯ @updater ã¨ãã
- JSONã¹ãã¼ãã®ä»£æ¿æ§æã¨ãã¦ã¯ãã¾ã£ãCaty/Jcentricåå®ç¾©ã§ãããIDLï¼Interface Definition Languageï¼ã¨ãã¦å©ç¨ãããã¨ã«ãªãããã§ããããå°ãæ¡å¼µããã°ãIDLã¨ãã¦ã®ä½è£ãæ´ãã§ãããã