Search in sources :

Example 1 with IndexEntityType

use of org.neo4j.kernel.impl.index.IndexEntityType in project neo4j by neo4j.

the class LegacyIndexTransactionApplier method applier.

/**
     * Get an applier suitable for the specified IndexCommand.
     */
private TransactionApplier applier(IndexCommand command) throws IOException {
    // Have we got an applier for this index?
    String indexName = defineCommand.getIndexName(command.getIndexNameId());
    Map<String, TransactionApplier> applierByIndex = applierByIndexMap(command);
    TransactionApplier applier = applierByIndex.get(indexName);
    if (applier == null) {
        // We don't. Have we got an applier for the provider of this index?
        IndexEntityType entityType = IndexEntityType.byId(command.getEntityType());
        Map<String, String> config = indexConfigStore.get(entityType.entityClass(), indexName);
        if (config == null) {
            // Could be that the index provider is temporarily unavailable?
            return TransactionApplier.EMPTY;
        }
        String providerName = config.get(PROVIDER);
        applier = applierByProvider.get(providerName);
        if (applier == null) {
            // We don't, so create the applier
            applier = applierLookup.newApplier(providerName, mode.needsIdempotencyChecks());
            applier.visitIndexDefineCommand(defineCommand);
            applierByProvider.put(providerName, applier);
        }
        // Also cache this applier for this index
        applierByIndex.put(indexName, applier);
    }
    return applier;
}
Also used : IndexEntityType(org.neo4j.kernel.impl.index.IndexEntityType)

Aggregations

IndexEntityType (org.neo4j.kernel.impl.index.IndexEntityType)1