| 42 | // TODO These three methods (setUser, getUser, and getUserIDsInRegion) |
| 43 | // are all in the recipe book. |
| 44 | public static void setUser(TransactionContext tcx, final String ID, final String name, final String zipcode){ |
| 45 | tcx.run(new Function<Transaction,Void>() { |
| 46 | public Void apply(Transaction tr){ |
| 47 | tr.set(main.pack(Tuple.from(ID,zipcode)), Tuple.from(name).pack()); |
| 48 | tr.set(index.pack(Tuple.from(zipcode,ID)), Tuple.from().pack()); |
| 49 | return null; |
| 50 | } |
| 51 | }); |
| 52 | } |
| 53 | |
| 54 | // Normal lookup. |
| 55 | public static String getUser(TransactionContext tcx, final String ID){ |