public void ingest(IndexOperationMessage singleMessage) { this.indexRequests.addAll(singleMessage.getIndexRequests()); this.deIndexRequests.addAll(singleMessage.getDeIndexRequests()); } }
@Override public int size() { return container.getDeIndexRequests().size() + container.getIndexRequests().size(); } }
public Observable<IndexOperationMessage> put( IndexOperationMessage message ) { Preconditions.checkNotNull(message, "Message cannot be null"); indexSizeCounter.inc(message.getDeIndexRequests().size()); indexSizeCounter.inc(message.getIndexRequests().size()); return processBatch(message); }
/** * this method will call initialize for each message, since we are caching the entity indexes, * we don't worry about aggregating by app id * @param indexOperationMessage */ private void initializeEntityIndexes(final IndexOperationMessage indexOperationMessage) { // create a set so we can have a unique list of appIds for which we call createEntityIndex Set<UUID> appIds = new HashSet<>(); // loop through all indexRequests and add the appIds to the set indexOperationMessage.getIndexRequests().forEach(req -> { UUID appId = IndexingUtils.getApplicationIdFromIndexDocId(req.documentId); appIds.add(appId); }); // loop through all deindexRequests and add the appIds to the set indexOperationMessage.getDeIndexRequests().forEach(req -> { UUID appId = IndexingUtils.getApplicationIdFromIndexDocId(req.documentId); appIds.add(appId); }); // for each of the appIds in the unique set, call create entity index to ensure the aliases are created appIds.forEach(appId -> { ApplicationScope appScope = CpNamingUtils.getApplicationScope(appId); entityIndexFactory.createEntityIndex(indexLocationStrategyFactory.getIndexLocationStrategy(appScope)); } ); }
final Set<DeIndexOperation> deIndexOperationSet = batch.getDeIndexRequests(); final Observable<DeIndexOperation> deIndex = Observable.from(batch.getDeIndexRequests());
null ); assertEquals( 1, indexOperationMessage.getDeIndexRequests().size() );
assertEquals( 1, indexOperationMessage.getDeIndexRequests().size() );