Search in sources :

Example 1 with IndexSetDeletedEvent

use of org.graylog2.indexer.indexset.events.IndexSetDeletedEvent in project graylog2-server by Graylog2.

the class MongoIndexSetService method delete.

/**
     * {@inheritDoc}
     */
@Override
public int delete(ObjectId id) {
    if (!isDeletable(id)) {
        return 0;
    }
    final DBQuery.Query query = DBQuery.is("_id", id);
    final WriteResult<IndexSetConfig, ObjectId> writeResult = collection.remove(query);
    final int removedEntries = writeResult.getN();
    if (removedEntries > 0) {
        final IndexSetDeletedEvent deletedEvent = IndexSetDeletedEvent.create(id.toHexString());
        clusterEventBus.post(deletedEvent);
    }
    return removedEntries;
}
Also used : ObjectId(org.bson.types.ObjectId) DBQuery(org.mongojack.DBQuery) IndexSetDeletedEvent(org.graylog2.indexer.indexset.events.IndexSetDeletedEvent)

Aggregations

ObjectId (org.bson.types.ObjectId)1 IndexSetDeletedEvent (org.graylog2.indexer.indexset.events.IndexSetDeletedEvent)1 DBQuery (org.mongojack.DBQuery)1