Skip to content

Instantly share code, notes, and snippets.

View goncalotomas's full-sized avatar

Gonçalo Tomás goncalotomas

View GitHub Profile
@goncalotomas
goncalotomas / transaction-with-map.erl
Created May 2, 2016 20:59
Map read fails after write, no idea why... :(
(goncalo@127.0.0.1)1> Node = 'antidote@127.0.0.1'.
'antidote@127.0.0.1'
(goncalo@127.0.0.1)2> StartTxn = fun() -> rpc:call(Node,antidote,start_transaction,[ignore, []]) end.
#Fun<erl_eval.20.50752066>
(goncalo@127.0.0.1)3> AddRead = fun(Bucket,Txn) -> rpc:call(Node, antidote, read_objects, [[Bucket],Txn]) end.
#Fun<erl_eval.12.50752066>
(goncalo@127.0.0.1)4> AddWrite = fun(Bucket,Op,Param,Txn) -> rpc:call(Node, antidote, update_objects, [[{Bucket,Op,Param}], Txn]) end.
#Fun<erl_eval.4.50752066>
(goncalo@127.0.0.1)5> CommitTxn = fun(Txn) -> rpc:call(Node,antidote,commit_transaction,[Txn]) end.
#Fun<erl_eval.6.50752066>
(fmk@127.0.0.1)1>rpc:call('antidote@127.0.0.1',antidote,append,
[patients,riak_dt_map,{update,
[{add, {key, riak_dt_lwwreg}},
{add, {val, riak_dt_pncounter}}
]
}]).
{error,
{type_check,
{update,
{patients,riak_dt_map,