| 79 | } |
| 80 | |
| 81 | public static void subtract(TransactionContext tcx, final String index, |
| 82 | final Object value){ |
| 83 | tcx.run(new Function<Transaction,Void>() { |
| 84 | public Void apply(Transaction tr){ |
| 85 | Future<byte[]> v = tr.get(multi.subspace( |
| 86 | Tuple.from(index,value)).getKey()); |
| 87 | |
| 88 | if(v.get() != null && getLong(v.get()) > 1l){ |
| 89 | addHelp(tr, multi.subspace(Tuple.from(index,value)).getKey(), -1l); |
| 90 | } else { |
| 91 | tr.clear(multi.subspace(Tuple.from(index,value)).getKey()); |
| 92 | } |
| 93 | return null; |
| 94 | } |
| 95 | }); |
| 96 | } |
| 97 | |
| 98 | public static ArrayList<Object> get(TransactionContext tcx, final String index){ |
| 99 | return tcx.run(new Function<Transaction,ArrayList<Object> >() { |