Dynohub, a Clojure DynamoDB client with transaction layer

https://github.com/ozjongwon/dynohub


Dynohub is a transperent DynamoDB client with a port of transaction 
library(https://github.com/awslabs/dynamodb-transactions)

There are three layers of abstraction:
  * Dynohub  - a plain client layer
  * Dynolite - a handy client layer on top of Dynohub
  * Dynotx   - a transaction enabled client layer on top of Dynolite

(NOTE: All the limits of Amazon's transaction library also applied to 
Dynohub's transaction layer, Dynotx)

Using 'with-transaction' macro you can add transaction! An example (from 
test):

(deftest conflicting-tx-test
  (testing "Conflicts"
    (setup-db)
    (dt/with-transaction [t1]
      (dt/put-item test-table {:id "conflictingTransactions_Item1" 
:which-transaction? "t1"})
      (dt/put-item test-table {:id "conflictingTransactions_Item2"})
      (dt/with-transaction [t2]
        (dt/put-item test-table {:id "conflictingTransactions_Item1" 
:which-transaction? "t2 - I win!"})
        (utils/ignore-errors (dt/commit t1))
        (dt/put-item test-table {:id "conflictingTransactions_Item3"})))
    (is (empty? (dl/scan :_tx_table_)))
    (is (empty? (dl/scan :_image_table_)))

    (is (empty? (dl/get-item test-table {:id 
"conflictingTransactions_Item2"})))
    (is (not (empty? (dl/get-item test-table {:id 
"conflictingTransactions_Item3"}))))
    (is (= (get (dl/get-item test-table {:id 
"conflictingTransactions_Item1"}) :which-transaction?)
           "t2 - I win!"))))

Any bug reports will be appreciated.

Cheers

- Jong-won Choi

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to