@Override public boolean checkIndexExistence( IndexEntityType entityType, String indexName, Map<String,String> config ) { Map<String, String> configuration = indexConfigStore.get( entityType.entityClass(), indexName ); if ( configuration == null ) { return false; } String providerName = configuration.get( IndexManager.PROVIDER ); IndexImplementation provider = providerLookup.getProviderByName( providerName ); assertConfigMatches( provider, indexName, configuration, config ); return true; }
void deleteIndex( IndexIdentifier identifier, boolean recovery ) throws IOException { if ( readOnly ) { throw new IllegalStateException( "Index deletion in read only mode is not supported." ); } closeIndex( identifier ); FileUtils.deleteRecursively( getFileDirectory( baseStorePath, identifier ) ); indexTypeMap.remove( identifier ); boolean removeFromIndexStore = !recovery || (indexStore.has( identifier.entityType.entityClass(), identifier.indexName )); if ( removeFromIndexStore ) { indexStore.remove( identifier.entityType.entityClass(), identifier.indexName ); } typeCache.invalidate( identifier ); }
IndexType getIndexType( IndexIdentifier identifier, boolean recovery ) throws ExplicitIndexNotFoundKernelException { Pair<Integer, IndexType> type = cache.get( identifier ); Map<String, String> config = indexStore.get( identifier.entityType.entityClass(), identifier.indexName ); if ( config == null ) { if ( recovery ) { return null; } throw new ExplicitIndexNotFoundKernelException( "Index '%s' doesn't exist.", identifier ); } if ( type != null && config.hashCode() == type.first() ) { return type.other(); } type = Pair.of( config.hashCode(), IndexType.getIndexType( config ) ); cache.put( identifier, type ); return type.other(); }
Map<String,String> config = indexConfigStore.get( entityType.entityClass(), indexName ); if ( config == null )
entityType.entityClass(), indexName, suppliedConfig, this.config ); if ( !indexStore.has( entityType.entityClass(), indexName ) ) Map<String,String> existing = indexStore.get( entityType.entityClass(), indexName ); if ( existing != null )
@Override public boolean visitIndexCreateCommand( IndexCommand.CreateCommand command ) throws IOException { indexConfigStore.setIfNecessary( IndexEntityType.byId( command.getEntityType() ).entityClass(), defineCommand.getIndexName( command.getIndexNameId() ), command.getConfig() ); return applier( command ).visitIndexCreateCommand( command ); }
@Override public boolean checkIndexExistence( IndexEntityType entityType, String indexName, Map<String,String> config ) { Map<String, String> configuration = indexConfigStore.get( entityType.entityClass(), indexName ); if ( configuration == null ) { return false; } String providerName = configuration.get( IndexManager.PROVIDER ); IndexImplementation provider = providerLookup.getProviderByName( providerName ); assertConfigMatches( provider, indexName, configuration, config ); return true; }
Map<String,String> config = indexConfigStore.get( entityType.entityClass(), indexName ); if ( config == null )
entityType.entityClass(), indexName, suppliedConfig, this.config ); if ( !indexStore.has( entityType.entityClass(), indexName ) ) Map<String,String> existing = indexStore.get( entityType.entityClass(), indexName ); if ( existing != null )
@Override public boolean visitIndexCreateCommand( IndexCommand.CreateCommand command ) throws IOException { indexConfigStore.setIfNecessary( IndexEntityType.byId( command.getEntityType() ).entityClass(), defineCommand.getIndexName( command.getIndexNameId() ), command.getConfig() ); return applier( command ).visitIndexCreateCommand( command ); }