| 109 | } |
| 110 | |
| 111 | public static HashMap<Object,Long> getCounts(TransactionContext tcx, |
| 112 | final String index){ |
| 113 | return tcx.run(new Function<Transaction,HashMap<Object,Long> >() { |
| 114 | public HashMap<Object,Long> apply(Transaction tr){ |
| 115 | HashMap<Object,Long> vals = new HashMap<Object,Long>(); |
| 116 | for(KeyValue kv : tr.getRange(multi.subspace( |
| 117 | Tuple.from(index)).range())){ |
| 118 | vals.put(multi.unpack(kv.getKey()).get(1), |
| 119 | getLong(kv.getValue())); |
| 120 | } |
| 121 | return vals; |
| 122 | } |
| 123 | }); |
| 124 | } |
| 125 | |
| 126 | public static boolean isElement(TransactionContext tcx, final String index, |
| 127 | final Object value){ |