Last active
August 29, 2015 14:07
-
-
Save curtislinden/99eb4251c4e17d05be16 to your computer and use it in GitHub Desktop.
food for thought...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(still test-set transactional memory semantics) | |
-- I went back to drawing board and asked the question - what if the resource version whas just a transparent mechanism of the resource - IE: model this as direct operations on remote resource... | |
I get the purchase | |
/http?get/my/inventory | |
=> { inventory:[{id:1, name:'old boot'}], txn_version: 7 } | |
/http?post/my/inventory | |
<= { inventory:[{id:1, name:'old boot'}, {id:36,name:'new boots'}], txn_version: 7 } | |
=> (OK|ERROR) | |
--- OK would bump txn_version such that any successive get would return txn_version:8 | |
I loose 1000 cents for my purchase | |
/http?get/my/wallet | |
=> { wallet:{id:1, amount_in_cents: 9000}, txn_version:18} | |
/http?post/my/wallet | |
<= { wallet:{id:1, amount_in_cents: 8000}, txn_version:18} | |
linden gets 5 cents | |
/http?get/linden/wallet | |
=> { wallet:{id:1, amount_in_cents: 1000000}, txn_version:1812} | |
/http?post/my/wallet | |
<= { wallet:{id:1, amount_in_cents: 1000005}, txn_version:1812} | |
sue gets 995 Cents | |
/http?get/sue/wallet | |
=> { wallet:{id:1, amount_in_cents: 1000}, txn_version:1914} | |
/http?post/my/wallet | |
<= { wallet:{id:1, amount_in_cents: 1995}, txn_version:1914} | |
ROLLBACK ALL STATE: | |
http?post/my/inventory/rollback/txn_version=7 | |
http?post/my/wallet/rollback/txn_version=18 | |
http?post/linden/wallet/rollback/txn_version=1812 | |
http?post/sue/wallet/rollback/txn_version=1914 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment