• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Couch Db.0.9.0.Pub
 

Couch Db.0.9.0.Pub

on

  • 2,368 views

CouchDB 0.9.0 Overview in Japanese

CouchDB 0.9.0 Overview in Japanese

Statistics

Views

Total Views
2,368
Views on SlideShare
2,366
Embed Views
2

Actions

Likes
2
Downloads
12
Comments
1

1 Embed 2

http://www.slideshare.net 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • I liked the images used in this slide. Cheers!

    http://www.bathroomsinkconsoles.net/
    http://www.bathroomsinkconsoles.net/category/bathroom-sink-consoles/
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Couch Db.0.9.0.Pub Couch Db.0.9.0.Pub Presentation Transcript

    • Apache CouchDB 0.9.0 リリース記念資料 id:yssk22 http://d.hatena.ne.jp/yssk22
    • CouchDB復習
    • 1. ドキュメント指向
    • JSONのデータを ためる入れ物
    • { quot;_idquot; : quot;文書1quot; quot;_revquot; : quot;リビジョンquot; quot;titlequot; : quot;CouchDBについてquot; quot;Contentquot; : quot;いろいろquot; }
    • 2. Web+DB
    • REST
    • HTTP
    • 3. 非リレーショナル
    • MapReduce := SQLめんどう
    • HTTP Request HTTP map HTTP Response reduce
    • 4. Replication
    • http://couch.io/CouchDB-Intro-EU.pdf のP.32からみるとおもしろい
    • 0.9.0の話
    • Changes (公式より) • Modular configuration. • Performance enhancements for document and view access. • More resilient replication process. • Replication streams binary attachments. • Administrator role and basic authentication. • Document validation functions in design documents. • Show and list functions for rendering documents and views as developer controlled content-types. • External process server module. • Attachment uploading from Futon. • Etags for views, lists, shows, document and attachment requests. • Miscellaneous improvements to build, system integration, and portability.
    • 目玉?
    • Show and list functions for rendering documents and views as developer controlled content-types.
    • Blogアプリで考える。
    • タイトル、タグ、 内容 文書のIDは日付で。
    • アプリケーション サーバー丌要論
    • 特に RESTful/RESTonlyな アプリケーションは CouchDBでOK
    • RESTful Rails Controller#index Controller#show Controller#new Controller#craete Controller#update Controller#edit Controller#destroy
    • RESTful Rails Controller#index Controller#show Controller#new 省略 Controller#craete Controller#update Controller#edit Controller#destroy
    • JavaScriptで Renderingを書く
    • Show
    • RESTful Rails Controller#index Controller#show Controller#new Controller#craete Controller#update Controller#edit Controller#destroy
    • { quot;_idquot;: quot;_design/testquot;, quot;_revquot;: quot;9-938762531quot;, quot;languagequot;: quot;javascriptquot;, quot;viewsquot;: { }, quot;showsquot;: { quot;displayquot;: quot;(function (doc, req) {if (doc) {return ¥quot;<h1>¥quot; + doc.title + ¥quot;</h1><div>¥quot;+ doc.content + ¥quot;</div>¥quot;;} else {if (req.docId) {return ¥quot;New World¥quot;;} else {return ¥quot;Empty World¥quot;;}}})quot; }
    • GET DB デザインドキュメントのID /my_blog/_design/test/_show/ display/2009_04_20_1 shows のキー レンダリングするドキュメントのID
    • <h1>今日は疲れた </h1><div><p>CouchDBの機能 調査をしていたけどドキュメントがな い</p></div>
    • Restful Rails でいうと ころの、show をやって くれる
    • IDにマッチする文書が 見つからなければ HTML Formを返すとか
    • Controller#new, Controller#edit 相当はできる!
    • list
    • RESTful Rails Controller#index Controller#show Controller#new Controller#craete Controller#update Controller#edit Controller#destroy
    • { quot;_idquot;: quot;_design/testquot;, quot;_revquot;: quot;9-938762531quot;, quot;languagequot;: quot;javascriptquot;, quot;viewsquot;: { }, quot;listsquot;: { quot;simplequot;: quot;(function (head, row, req, row_info) {if (row) {return {body: ¥quot;<h1>¥quot; + row.key + ¥quot;</h1>¥quot; + ¥quot;<h2>¥quot; + row.value.title + ¥quot;</h2>¥quot; + ¥quot;<div>¥quot; + row.value.content + ¥quot;</div>¥quot;}; } else if (head) {return {body: ¥quot;<h1>My Blog (¥quot; + head.total_rows + ¥quot;件のエントリ)</h1>¥quot;};} else {return {body: ¥quot;</ul>¥quot; + ¥quot;<p>前へ: ¥quot; + (row_info ? row_info.first_key : ¥quot;¥quot;) + ¥quot; 次 へ: ¥quot; + (row_info ? row_info.prev_key : ¥quot;¥quot;) + ¥quot;</p>¥quot;};}})quot; } }
    • simple: function (head, row, req, row_info) { 本体 if (row) { return { body: quot;<h1>quot; + row.key + quot;</h1>quot; + quot;<h2>quot; + row.value.title + quot;</h2>quot; + quot;<div>quot; + row.value.content + quot;</div>quot; }; } else if (head) { ヘッダ return { body: quot;<h1>My Blog (quot; + head.total_rows + quot;件のエントリ)</h1>quot;}; フッタ } else { return { body: quot;<p>前へ: quot; + (row_info ? row_info.first_key : quot;quot; ) + quot; 次へ: quot; + (row_info ? row_info.prev_key : quot;quot;) + quot;</p>quot; }; } })
    • GET /my_blog/_design/test/_list/ simple/posts_by_date lists のキー MapReduce View のキー
    • RESTful Rails でいうとこ ろの、Controller#index をやってくれるもの
    • MapReduce からレンダリ ングまでイッキに。
    • コンテント ネゴシエーション もできる
    • JavaScript Runtime の初期化時に、 以下の要領でType設定 registerType(quot;allquot;, quot;*/*quot;); registerType(quot;textquot;, quot;text/plainquot;, quot;txtquot;); registerType(quot;htmlquot;, quot;text/htmlquot;); registerType(quot;xhtmlquot;, quot;application/xhtml+xmlquot;, quot;xhtmlquot;); registerType(quot;xmlquot;, quot;application/xmlquot;, quot;text/xmlquot;, quot;application/x-xmlquot;); registerType(quot;jsonquot;, quot;application/jsonquot;, quot;text/x-jsonquot;); registerType(quot;jsquot;, quot;text/javascriptquot;, quot;application/javascriptquot;, quot;application/x- javascriptquot;); registerType(quot;cssquot;, quot;text/cssquot;); registerType(quot;icsquot;, quot;text/calendarquot;); registerType(quot;csvquot;, quot;text/csvquot;); registerType(quot;rssquot;, quot;application/rss+xmlquot;); registerType(quot;atomquot;, quot;application/atom+xmlquot;); registerType(quot;yamlquot;, quot;application/x-yamlquot;, quot;text/yamlquot;); registerType(quot;multipart_formquot;, quot;multipart/form-dataquot;);
    • respondWith で返す! return respondWith(req, { html : function() { return { body:quot;<p>Ha ha, you said ¥quot;quot; + doc.word + quot;¥quot;.quot; }; }, xml : function() { return { body: quot;<xml ...>quot; }; }, fallback : quot;htmlquot; });
    • 3XX とかもOK
    • return {quot;codequot;: 303, quot;bodyquot;: quot;See Otherquot;, quot;headersquot;: {quot;Locationquot;: quot;/quot;}};
    • 0.9.0 新機能! •Show and list functions for rendering documents and views as developer controlled content-types.
    • 0.9.0 新機能(その他)! •一言で
    • Basic 認証とデータバリ デーションができるように なって、いろいろ既存機 能向上した
    • jQuery と CouchDB でアプリは完成できる!? あと、Apache mod*があると便利
    • 余談: CouchDBで作ると おもしろそうなアプリ
    • OpenSocial Container
    • OpenSocial Container の要件
    • JavaScript (gadgets) + REST (API) + KV Store (Persistence)
    • これはCouch
    • • 公式 ▫ http://couchdb.apache.org/ • ドキュメント(違 ▫ http://localhost:5984/_utils/couch_tests.html?script/ couch_tests.js • OpenSocial with CouchDB ▫ http://github.com/yssk22/webjourney/tree/opensoci al ▫ まだ何もつくっていない ▫ 開発者募集中  Apache Shindig と jQuery と (必要があればRails)でなんと かなるんじゃないかと。 • id:yssk22 が記述するすべてのコンテンツは個人の意見 であり、勤務先の組織とは一切無関係のものです。