@Test void updateIndexOnDeleteShouldDeleteMessageFromDeletedMessage() { MailboxMessage message = mock(MailboxMessage.class); when(message.getUid()).thenReturn(MESSAGE_UID); deletedMessageDAO.addDeleted(MAILBOX_ID, MESSAGE_UID).block(); testee.updateIndexOnDelete(new ComposedMessageIdWithMetaData( new ComposedMessageId(MAILBOX_ID, CASSANDRA_MESSAGE_ID, MESSAGE_UID), new Flags(Flags.Flag.DELETED), MODSEQ), MAILBOX_ID).block(); assertThat( deletedMessageDAO .retrieveDeletedMessage(MAILBOX_ID, MessageRange.all()) .collectList() .block()) .isEmpty(); }
public Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId) { MessageUid uid = composedMessageIdWithMetaData.getComposedMessageId().getUid(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, updateFirstUnseenOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags(), composedMessageIdWithMetaData.getComposedMessageId().getUid()), mailboxRecentDAO.removeFromRecent(mailboxId, composedMessageIdWithMetaData.getComposedMessageId().getUid()), updateDeletedMessageProjectionOnDelete(mailboxId, uid, composedMessageIdWithMetaData.getFlags()), decrementCountersOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags())) .then(); }
CassandraIndexTableHandler { public Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId) { MessageUid uid = composedMessageIdWithMetaData.getComposedMessageId().getUid(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, updateFirstUnseenOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags(), composedMessageIdWithMetaData.getComposedMessageId().getUid()), mailboxRecentDAO.removeFromRecent(mailboxId, composedMessageIdWithMetaData.getComposedMessageId().getUid()), updateDeletedMessageProjectionOnDelete(mailboxId, uid, composedMessageIdWithMetaData.getFlags()), decrementCountersOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags())) .then(); } }
CassandraIndexTableHandler { public Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId) { MessageUid uid = composedMessageIdWithMetaData.getComposedMessageId().getUid(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, updateFirstUnseenOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags(), composedMessageIdWithMetaData.getComposedMessageId().getUid()), mailboxRecentDAO.removeFromRecent(mailboxId, composedMessageIdWithMetaData.getComposedMessageId().getUid()), updateDeletedMessageProjectionOnDelete(mailboxId, uid, composedMessageIdWithMetaData.getFlags()), decrementCountersOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags())) .then(); } @Inject  CassandraIndexTableHandler(CassandraMailboxRecentsDAO mailboxRecentDAO,
                                      CassandraMailboxCounterDAO mailboxCounterDAO,
                                      CassandraFirstUnseenDAO firstUnseenDAO,
                                      CassandraApplicableFlagDAO applicableFlagDAO,
                                      CassandraDeletedMessageDAO deletedMessageDAO); }
CassandraIndexTableHandler { public Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId) { MessageUid uid = composedMessageIdWithMetaData.getComposedMessageId().getUid(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, updateFirstUnseenOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags(), composedMessageIdWithMetaData.getComposedMessageId().getUid()), mailboxRecentDAO.removeFromRecent(mailboxId, composedMessageIdWithMetaData.getComposedMessageId().getUid()), updateDeletedMessageProjectionOnDelete(mailboxId, uid, composedMessageIdWithMetaData.getFlags()), decrementCountersOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags())) .then(); } @Inject  CassandraIndexTableHandler(CassandraMailboxRecentsDAO mailboxRecentDAO,
                                      CassandraMailboxCounterDAO mailboxCounterDAO,
                                      CassandraFirstUnseenDAO firstUnseenDAO,
                                      CassandraApplicableFlagDAO applicableFlagDAO,
                                      CassandraDeletedMessageDAO deletedMessageDAO); Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId); Mono<Void> updateIndexOnDelete(CassandraId mailboxId, Collection<MessageMetaData> metaData); Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId); Mono<Void> updateIndexOnFlagsUpdate(CassandraId mailboxId, UpdatedFlags updatedFlags); Mono<Void> updateIndexOnFlagsUpdate(CassandraId mailboxId, List<UpdatedFlags> updatedFlags); }
CassandraIndexTableHandler { public Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId) { MessageUid uid = composedMessageIdWithMetaData.getComposedMessageId().getUid(); return Flux.mergeDelayError(Queues.XS_BUFFER_SIZE, updateFirstUnseenOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags(), composedMessageIdWithMetaData.getComposedMessageId().getUid()), mailboxRecentDAO.removeFromRecent(mailboxId, composedMessageIdWithMetaData.getComposedMessageId().getUid()), updateDeletedMessageProjectionOnDelete(mailboxId, uid, composedMessageIdWithMetaData.getFlags()), decrementCountersOnDelete(mailboxId, composedMessageIdWithMetaData.getFlags())) .then(); } @Inject  CassandraIndexTableHandler(CassandraMailboxRecentsDAO mailboxRecentDAO,
                                      CassandraMailboxCounterDAO mailboxCounterDAO,
                                      CassandraFirstUnseenDAO firstUnseenDAO,
                                      CassandraApplicableFlagDAO applicableFlagDAO,
                                      CassandraDeletedMessageDAO deletedMessageDAO); Mono<Void> updateIndexOnDelete(ComposedMessageIdWithMetaData composedMessageIdWithMetaData, CassandraId mailboxId); Mono<Void> updateIndexOnDelete(CassandraId mailboxId, Collection<MessageMetaData> metaData); Mono<Void> updateIndexOnAdd(MailboxMessage message, CassandraId mailboxId); Mono<Void> updateIndexOnFlagsUpdate(CassandraId mailboxId, UpdatedFlags updatedFlags); Mono<Void> updateIndexOnFlagsUpdate(CassandraId mailboxId, List<UpdatedFlags> updatedFlags);  }