use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.
the class FusionIndexProviderTest method mockProvider.
private static IndexProvider mockProvider(Class<? extends IndexProvider> providerClass, String name) {
IndexProvider mock = mock(providerClass);
when(mock.getProviderDescriptor()).thenReturn(new IndexProviderDescriptor(name, "1"));
return mock;
}
use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.
the class MultiIndexPopulationConcurrentUpdatesIT method createIndexRules.
private IndexDescriptor[] createIndexRules(GraphDatabaseSettings.SchemaIndex schemaIndex, Map<String, Integer> labelNameIdMap, int propertyId) {
final IndexProviderMap indexProviderMap = getIndexProviderMap();
IndexProvider indexProvider = indexProviderMap.lookup(schemaIndex.providerName());
IndexProviderDescriptor providerDescriptor = indexProvider.getProviderDescriptor();
List<IndexDescriptor> list = new ArrayList<>();
for (Integer labelId : labelNameIdMap.values()) {
final LabelSchemaDescriptor schema = SchemaDescriptor.forLabel(labelId, propertyId);
IndexDescriptor index = IndexPrototype.forSchema(schema, providerDescriptor).withName("index_" + labelId).materialise(labelId);
index = indexProvider.completeConfiguration(index);
list.add(index);
}
return list.toArray(new IndexDescriptor[0]);
}
use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.
the class BuiltInProcedures method createUniquePropertyConstraint.
@Deprecated(since = "4.2.0", forRemoval = true)
@Description("Create a named unique property constraint. Backing index will use specified index provider and configuration (optional). " + "Yield: name, labels, properties, providerName, status")
@Procedure(name = "db.createUniquePropertyConstraint", mode = SCHEMA, deprecatedBy = "CREATE CONSTRAINT ... IS UNIQUE command")
public Stream<SchemaIndexInfo> createUniquePropertyConstraint(@Name("constraintName") String constraintName, @Name("labels") List<String> labels, @Name("properties") List<String> properties, @Name("providerName") String providerName, @Name(value = "config", defaultValue = "{}") Map<String, Object> config) throws ProcedureException {
IndexProcedures indexProcedures = indexProcedures();
final IndexProviderDescriptor indexProviderDescriptor = getIndexProviderDescriptor(providerName);
return indexProcedures.createUniquePropertyConstraint(constraintName, labels, properties, indexProviderDescriptor, config);
}
use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.
the class SchemaLoggingIT method shouldLogUserReadableLabelAndPropertyNames.
@Test
void shouldLogUserReadableLabelAndPropertyNames() {
String labelName = "User";
String property = "name";
// when
long indexId = createIndex(db, labelName, property);
// then
IndexProvider defaultProvider = indexProviderMap.getDefaultProvider();
IndexProviderDescriptor providerDescriptor = defaultProvider.getProviderDescriptor();
String indexName = "Index( id=" + indexId + ", name='index_a908f819', type='GENERAL BTREE', " + "schema=(:User {name}), indexProvider='" + providerDescriptor.name() + "' )";
assertThat(logProvider).forLevel(INFO).containsMessageWithArguments("Index population started: [%s]", indexName).containsMessageWithArguments(CREATION_FINISHED, indexName);
}
use of org.neo4j.internal.schema.IndexProviderDescriptor in project neo4j by neo4j.
the class AccessUniqueDatabaseIndexTest method getIndexStorage.
private PartitionedIndexStorage getIndexStorage() {
IndexProviderDescriptor descriptor = new IndexProviderDescriptor(NATIVE30.providerKey(), NATIVE30.providerVersion());
IndexDirectoryStructure parent = directoriesByProvider(databaseLayout.databaseDirectory()).forProvider(descriptor);
IndexStorageFactory storageFactory = new IndexStorageFactory(directoryFactory, fileSystem, directoriesBySubProvider(parent).forProvider(LuceneIndexProvider.DESCRIPTOR));
return storageFactory.indexStorageOf(1);
}
Aggregations