private StoreLayerModule buildStoreLayer( Config config, final NeoStore neoStore, PersistenceCache persistenceCache, PropertyKeyTokenHolder propertyKeyTokenHolder, LabelTokenHolder labelTokens, RelationshipTypeTokenHolder relationshipTypeTokens, IndexingService indexingService, SchemaCache schemaCache) { Provider<NeoStore> neoStoreProvider = new Provider<NeoStore>() { @Override public NeoStore instance() { return neoStoreModule.neoStore(); } }; final StoreReadLayer storeLayer; if (config.get(GraphDatabaseSettings.cache_type).equals(CacheLayer.EXPERIMENTAL_OFF)) { storeLayer = new DiskLayer( propertyKeyTokenHolder, labelTokens, relationshipTypeTokens, new SchemaStorage(neoStore.getSchemaStore()), neoStoreProvider, indexingService); } else { storeLayer = new CacheLayer( new DiskLayer( propertyKeyTokenHolder, labelTokens, relationshipTypeTokens, new SchemaStorage(neoStore.getSchemaStore()), neoStoreProvider, indexingService), persistenceCache, indexingService, schemaCache); } return new StoreLayerModule() { @Override public StoreReadLayer storeLayer() { return storeLayer; } }; }
private IndexingModule buildIndexing( Config config, JobScheduler scheduler, SchemaIndexProvider indexProvider, LockService lockService, TokenNameLookup tokenNameLookup, Logging logging, IndexingService.Monitor indexingServiceMonitor, NeoStore neoStore, UpdateableSchemaState updateableSchemaState) { final DefaultSchemaIndexProviderMap providerMap = new DefaultSchemaIndexProviderMap(indexProvider); final IndexingService indexingService = IndexingService.create( new IndexSamplingConfig(config), scheduler, providerMap, new NeoStoreIndexStoreView(lockService, neoStore), tokenNameLookup, updateableSchemaState, toList(new SchemaStorage(neoStore.getSchemaStore()).allIndexRules()), logging, indexingServiceMonitor); final IntegrityValidator integrityValidator = new IntegrityValidator(neoStore, indexingService); // TODO Move to constructor final LabelScanStore labelScanStore = dependencyResolver .resolveDependency( LabelScanStoreProvider.class, LabelScanStoreProvider.HIGHEST_PRIORITIZED) .getLabelScanStore(); life.add(indexingService); life.add(labelScanStore); return new IndexingModule() { @Override public IndexingService indexingService() { return indexingService; } @Override public LabelScanStore labelScanStore() { return labelScanStore; } @Override public IntegrityValidator integrityValidator() { return integrityValidator; } @Override public SchemaIndexProviderMap schemaIndexProviderMap() { return providerMap; } }; }