@Test public void testBirthdayIndex() { final UUID userId = storeUser(); runWithRetry(store -> { Set<UUID> usersWithBirthday = store.getUsersWithBirthday(USER.getBirthEpochDay()); Assert.assertEquals(ImmutableSet.of(userId), usersWithBirthday); return userId; }); }
public Set<UUID> getUsersWithBirthday(long birthEpochDays) { UserProfileTable table = tables.getUserProfileTable(tx); UserBirthdaysIdxTable idx = UserBirthdaysIdxTable.of(table); List<UserBirthdaysIdxColumnValue> columns = idx.getRowColumns(UserBirthdaysIdxRow.of(birthEpochDays)); return IterableView.of(columns) .transform(UserBirthdaysIdxColumnValue.getColumnNameFun()) .transform(UserBirthdaysIdxColumn.getIdFun()) .immutableSetCopy(); }
ProfileStore { public Set<UUID> getUsersWithBirthday(long birthEpochDays) { UserProfileTable table = tables.getUserProfileTable(tx); UserBirthdaysIdxTable idx = UserBirthdaysIdxTable.of(table); List<UserBirthdaysIdxColumnValue> columns = idx.getRowColumns(UserBirthdaysIdxRow.of(birthEpochDays)); return IterableView.of(columns) .transform(UserBirthdaysIdxColumnValue.getColumnNameFun()) .transform(UserBirthdaysIdxColumn.getIdFun()) .immutableSetCopy(); } }
ProfileStore { public Set<UUID> getUsersWithBirthday(long birthEpochDays) { UserProfileTable table = tables.getUserProfileTable(tx); UserBirthdaysIdxTable idx = UserBirthdaysIdxTable.of(table); List<UserBirthdaysIdxColumnValue> columns = idx.getRowColumns(UserBirthdaysIdxRow.of(birthEpochDays)); return IterableView.of(columns) .transform(UserBirthdaysIdxColumnValue.getColumnNameFun()) .transform(UserBirthdaysIdxColumn.getIdFun()) .immutableSetCopy(); } ProfileStore(TransactionManager txnMgr, Transaction tx); }
ProfileStore { public Set<UUID> getUsersWithBirthday(long birthEpochDays) { UserProfileTable table = tables.getUserProfileTable(tx); UserBirthdaysIdxTable idx = UserBirthdaysIdxTable.of(table); List<UserBirthdaysIdxColumnValue> columns = idx.getRowColumns(UserBirthdaysIdxRow.of(birthEpochDays)); return IterableView.of(columns) .transform(UserBirthdaysIdxColumnValue.getColumnNameFun()) .transform(UserBirthdaysIdxColumn.getIdFun()) .immutableSetCopy(); } ProfileStore(TransactionManager txnMgr, Transaction tx); UUID storeNewUser(UserProfile data); UserProfile getUserData(UUID userId); InputStream getImageForUser(UUID userId); void updateImage(UUID userId, Sha256Hash hash, InputStream imageData); void deleteImage(UUID userId); Set<UUID> getUsersWithBirthday(long birthEpochDays); }
ProfileStore { public Set<UUID> getUsersWithBirthday(long birthEpochDays) { UserProfileTable table = tables.getUserProfileTable(tx); UserBirthdaysIdxTable idx = UserBirthdaysIdxTable.of(table); List<UserBirthdaysIdxColumnValue> columns = idx.getRowColumns(UserBirthdaysIdxRow.of(birthEpochDays)); return IterableView.of(columns) .transform(UserBirthdaysIdxColumnValue.getColumnNameFun()) .transform(UserBirthdaysIdxColumn.getIdFun()) .immutableSetCopy(); } ProfileStore(TransactionManager txnMgr, Transaction tx); UUID storeNewUser(UserProfile data); UserProfile getUserData(UUID userId); InputStream getImageForUser(UUID userId); void updateImage(UUID userId, Sha256Hash hash, InputStream imageData); void deleteImage(UUID userId); Set<UUID> getUsersWithBirthday(long birthEpochDays);  }