Ruby on CouchDB - SimplyStored and RockingChair

3,793 views

Published on

Presentation by Jonathan Weiss about Ruby on CouchDB at Ruby User Group Berlin in Marc 2010. Present SimplyStored, a nice wrapper for Ruby object. RockingChair is an in-memory CouchDB for speeding up your tests.

Published in: Technology, Education
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,793
On SlideShare
0
From Embeds
0
Number of Embeds
391
Actions
Shares
0
Downloads
45
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Ruby on CouchDB - SimplyStored and RockingChair

  1. 1. SimplyStored & RockingChair Ruby on CouchDB Jonathan Weiss, 04.03.2010 Peritor GmbH Thursday, March 4, 2010
  2. 2. Peritor Cloud-Management und -Deployment made easy http://scalarium.com 2 Thursday, March 4, 2010
  3. 3. Database Requirements High availability Easy replication and copy Clustering 3 Thursday, March 4, 2010
  4. 4. CouchDB relax 4 Thursday, March 4, 2010
  5. 5. Die Lösung Built for the Web Scales Performant Replication built-in Flexible schema 5 Thursday, March 4, 2010
  6. 6. CouchDB { "_id": "BCCD12CBB", "_rev": "1-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } 6 Thursday, March 4, 2010
  7. 7. CouchDB { "_id": "BCCD12CBB", "_rev": "1-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } 7 Thursday, March 4, 2010
  8. 8. CouchDB { "_id": "BCCD12CBB", "_rev": "1-AB764C", "type": "person", "name": "Darth Vader", "age": 63, "headware": ["Helmet", "Sombrero"], "dark_side": true } 8 Thursday, March 4, 2010
  9. 9. CouchDB - CRUD Create and update: PUT /starwars/BCCD12CBB Read: GET /starwars/BCCD12CBB Delete: DELETE /starwars/BCCD12CBB 9 Thursday, March 4, 2010
  10. 10. CouchDB How do I query my data? 10 Thursday, March 4, 2010
  11. 11. CouchDB Views! 11 Thursday, March 4, 2010
  12. 12. CouchDB function(doc) { if (doc.headware) { for (var hat in doc.headware) { emit(hat, 1); } } } 12 Thursday, March 4, 2010
  13. 13. CouchDB function(keys, values, rereduce) { return sum(values); } 13 Thursday, March 4, 2010
  14. 14. CouchDB function(keys, values, rereduce) { return sum(values); } 14 Thursday, March 4, 2010
  15. 15. Queries SQL CouchDB JavaScript SELECT * FROM function(doc) { if (doc['ruby_class'] == 'User' && `users` WHERE doc['status'] == 1) { `users`.id = 5 emit([doc.project_id, doc.created_at], null); AND `status` = 1; } } 15 Thursday, March 4, 2010
  16. 16. Queries ActiveRecord SimplyStored class Project < ActiveRecord::Base class Project has_many :users include SimplyStored::Couch end has_many :users end Project.first.users Project.first.users 16 Thursday, March 4, 2010
  17. 17. SimplyStored SimplyStored Models Associations Validations Callbacks Dynamic finder S3 attachments Paranoid delete http://github.com/peritor/simply_stored 17 Thursday, March 4, 2010
  18. 18. SimplyStored Standing on the shoulders of giants: - CouchPotato - CouchRest - RestClient - HTTP - CouchDB http://github.com/peritor/simply_stored Thursday, March 4, 2010
  19. 19. RockingChair In-memory CouchDB - Just a big Hash - Speeds up your tests - Tests can run in parallel - Nice for debugging http://github.com/jweiss/rocking_chair Thursday, March 4, 2010
  20. 20. Now show me some Code! Thursday, March 4, 2010
  21. 21. Peritor GmbH Blücherstr. 22, Hof III Aufgang 6 10961 Berlin Tel.: +49 (0)30 69 20 09 84 0 Fax: +49 (0)30 69 20 09 84 9 Internet: www.peritor.com E-Mail: info@peritor.com © Peritor GmbH - Alle Rechte Vorbehalten Thursday, March 4, 2010

×