Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Git as NoSQL

608 views

Published on

NoSQL with git (Key-value database)

Published in: Technology
  • Be the first to comment

Git as NoSQL

  1. 1. @somkiat.cc 1
  2. 2. Git ๤ําหรับเก็บ code 2
  3. 3. Git ๤ําหรับเก็บ data ? 3
  4. 4. 4 NoSQL
  5. 5. No SQL Not only SQL Non-relational database Schema-less
  6. 6. 6
  7. 7. 7 Git ?
  8. 8. 8 Git as a data store ?
  9. 9. 9 Create database $git init hello && cd hello Initialized empty Git repository in ./hello/.git/
  10. 10. 10 Create data $echo '{"id": 1, "name": "Somkiat", "age": 30}' > 1.json $git add 1.json $git commit -m "Create new person" [master (root-commit) c1809c0] Create new person 1 file changed, 1 insertion(+) create mode 100644 1.json
  11. 11. 11 Read data $git show master:1.json {"id": 1, "name": "Somkiat", "age": 30}
  12. 12. 12 Create with hash object $echo '{"id": 1, "name": "Somkiat", "age": 30}' | git hash-object -w --stdin f8d407f8880d3126c45cc38dee9f025ddcd816ad
  13. 13. 13 Read data $git cat-file -p f8d407 {"id": 1, "name": "Somkiat", "age": 30}
  14. 14. 14 Key-value database !!
  15. 15. 15 Git data model
  16. 16. 16 .git/objects reference master commit c1809 tree bb819 blob d092a tree ab123 blob 67ab9
  17. 17. 17 Let’s programming
  18. 18. 18 Git store $git store set key value $git store get key $git store keys $git store save $git store clear
  19. 19. 19 Git workflow
  20. 20. 20 Speed On my machine 100 commits/second
  21. 21. 21 Transaction
  22. 22. 22 Concurrency
  23. 23. 23 Backup
  24. 24. 24 Replication
  25. 25. 25 Git as NoSQL Key-value
  26. 26. @somkiat.cc 26
  27. 27. 27 Resources https://github.com/up1/demo-git-as-nosql

×