public void indexBatch(final List<EdgeScope> edges, final long updatedSince, AsyncEventQueueType queueType) { final List<EntityIndexEvent> batch = new ArrayList<>(); edges.forEach(e -> { //change to id scope to avoid serialization issues batch.add(new EntityIndexEvent(queueFig.getPrimaryRegion(), new EntityIdScope(e.getApplicationScope(), e.getEdge().getTargetNode()), updatedSince)); }); if (logger.isTraceEnabled()) { logger.trace("Offering batch of EntityIndexEvent of size {}", batch.size()); } offerBatch( batch, queueType ); }
@Override public void queueEntityDelete(final ApplicationScope applicationScope, final Id entityId) { if (logger.isTraceEnabled()) { logger.trace("Offering EntityDeleteEvent for {}:{}", entityId.getUuid(), entityId.getType()); } // sent in region (not offerTopic) as the delete IO happens in-region, then queues a multi-region de-index op offer( new EntityDeleteEvent(queueFig.getPrimaryRegion(), new EntityIdScope( applicationScope, entityId ) ), AsyncEventQueueType.DELETE , null); }
public void deleteBatch(final List<EdgeScope> edges, final long updatedBefore, AsyncEventQueueType queueType) { final List<EntityDeleteEvent> batch = new ArrayList<>(); edges.forEach(e -> { //change to id scope to avoid serialization issues batch.add(new EntityDeleteEvent(queueFig.getPrimaryRegion(), new EntityIdScope(e.getApplicationScope(), e.getEdge().getTargetNode()), true, updatedBefore)); }); offerBatch(batch, queueType); }
@Override public Observable<EntityIdScope> getEntities( final Observable<ApplicationScope> appScopes ) { return appScopes.flatMap( applicationScope -> { final GraphManager gm = graphManagerFactory.createEdgeManager( applicationScope ); final Id applicationId = applicationScope.getApplication(); //load all nodes that are targets of our application node. I.E. // entities that have been saved final Observable<Id> entityNodes = targetIdObservable.getTargetNodes( gm, applicationId ); //create our application node to emit since it's an entity as well final Observable<Id> applicationNode = Observable.just( applicationId ); //merge both the specified application node and the entity node // so they all get used return Observable.merge( applicationNode, entityNodes ). map( id -> new EntityIdScope( applicationScope, id ) ); } ); }
@Override public void queueDeIndexOldVersion(final ApplicationScope applicationScope, final Id entityId, UUID markedVersion) { // queue the de-index of old versions to the topic so cleanup happens in all regions if (logger.isTraceEnabled()) { logger.trace("Offering DeIndexOldVersionsEvent for app {} {}:{}", applicationScope.getApplication().getUuid(), entityId.getUuid(), entityId.getType()); } offerTopic( new DeIndexOldVersionsEvent( queueFig.getPrimaryRegion(), new EntityIdScope( applicationScope, entityId), markedVersion), AsyncEventQueueType.DELETE ); }
@Override public void queueEntityIndexUpdate(final ApplicationScope applicationScope, final Entity entity, long updatedAfter, QueueIndexingStrategy queueIndexingStrategy) { if (logger.isTraceEnabled()) { logger.trace("Offering EntityIndexEvent for {}:{}", entity.getId().getUuid(), entity.getId().getType()); } EntityIndexEvent event = new EntityIndexEvent(queueFig.getPrimaryRegion(), new EntityIdScope(applicationScope, entity.getId()), updatedAfter); offer(event, queueIndexingStrategy); }
Observable.just( new EntityIdScope( scope, entity1.getId() ), new EntityIdScope( scope, entity2.getId() ) );