@Override public IndexReference indexReferenceUnchecked( SchemaDescriptor schema ) { return IndexDescriptorFactory.forSchema( schema, Optional.empty(), IndexProviderDescriptor.UNDECIDED ); }
@Override public IndexReference indexReferenceUnchecked( int label, int... properties ) { return IndexDescriptorFactory.forSchema( SchemaDescriptorFactory.forLabel( label, properties ), Optional.empty(), IndexProviderDescriptor.UNDECIDED ); }
public static IndexDescriptor forSchema( SchemaDescriptor schema, Optional<String> name, IndexProviderDescriptor providerDescriptor ) { return new IndexDescriptor( schema, GENERAL, name, providerDescriptor ); }
public static IndexDescriptor namedForLabel( String name, int labelId, int... propertyIds ) { return IndexDescriptorFactory.forSchema( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), Optional.of( name ), PROVIDER_DESCRIPTOR ); }
public static IndexDescriptor forLabel( int labelId, int... propertyIds ) { return IndexDescriptorFactory.forSchema( SchemaDescriptorFactory.forLabel( labelId, propertyIds ), PROVIDER_DESCRIPTOR ); }
public static StoreIndexDescriptor indexRule( long ruleId, int labelId, int propertyId, IndexProviderDescriptor descriptor ) { return IndexDescriptorFactory.forSchema( forLabel( labelId, propertyId ), descriptor ).withId( ruleId ); }
private StoreIndexDescriptor descriptor( long indexId ) { return IndexDescriptorFactory.forSchema( forLabel( labelId, propId ), PROVIDER_DESCRIPTOR ).withId( indexId ); }
private StoreIndexDescriptor indexRule( long ruleId, IndexProviderDescriptor descriptor, int labelId, int... propertyIds ) { return IndexDescriptorFactory.forSchema( forLabel( labelId, propertyIds ), descriptor ).withId( ruleId ); }
private StoreIndexDescriptor descriptor() { return IndexDescriptorFactory.forSchema( forLabel( labelId, propId ), PROVIDER_DESCRIPTOR ).withId( indexId ); }
@Before public void setup() { transaction = mock( KernelTransaction.class ); tokenRead = mock( TokenRead.class ); schemaRead = mock( SchemaRead.class ); procedure = new IndexProcedures( transaction, null ); descriptor = SchemaDescriptorFactory.forLabel( 123, 456 ); anyDescriptor = SchemaDescriptorFactory.forLabel( 0, 0 ); anyIndex = forSchema( anyDescriptor ); when( transaction.tokenRead() ).thenReturn( tokenRead ); when( transaction.schemaRead() ).thenReturn( schemaRead ); }
private IndexProxy[] mockedIndexProxies( int base, int count ) { IndexProxy[] existing = new IndexProxy[count]; for ( int i = 0; i < count; i++ ) { existing[i] = mock( IndexProxy.class ); when( existing[i].getDescriptor() ).thenReturn( forSchema( forLabel( base + i, 1 ), PROVIDER_DESCRIPTOR ).withId( i ).withoutCapabilities() ); } return existing; } }
private StoreIndexDescriptor[] createIndexRules( Map<String,Integer> labelNameIdMap, int propertyId ) { IndexProvider lookup = getIndexProviderMap().lookup( schemaIndex.providerName() ); IndexProviderDescriptor providerDescriptor = lookup.getProviderDescriptor(); return labelNameIdMap.values().stream() .map( index -> IndexDescriptorFactory.forSchema( SchemaDescriptorFactory.forLabel( index, propertyId ), providerDescriptor ).withId( index ) ) .toArray( StoreIndexDescriptor[]::new ); }
@Test public void shouldCreateIndexDescriptorsFromSchema() { IndexDescriptor desc; desc = IndexDescriptorFactory.forSchema( SchemaDescriptorFactory.forLabel( LABEL_ID, 1 ) ); assertThat( desc.type(), equalTo( IndexDescriptor.Type.GENERAL ) ); assertThat( desc.schema(), equalTo( SchemaDescriptorFactory.forLabel( LABEL_ID, 1 ) ) ); desc = IndexDescriptorFactory.uniqueForSchema( SchemaDescriptorFactory.forLabel( LABEL_ID, 1 ) ); assertThat( desc.type(), equalTo( IndexDescriptor.Type.UNIQUE) ); assertThat( desc.schema(), equalTo( SchemaDescriptorFactory.forLabel( LABEL_ID, 1 ) ) ); }
private void givenIndex( String label, String propKey ) { int labelId = token( label, labels ); int propId = token( propKey, propKeys ); IndexReference index = IndexDescriptorFactory.forSchema( forLabel( labelId, propId ), EMPTY.getProviderDescriptor() ); indexes.add( index ); }
public static SchemaRuleCommand createIndexRule( IndexProviderDescriptor provider, long id, LabelSchemaDescriptor descriptor ) { SchemaRule rule = IndexDescriptorFactory.forSchema( descriptor, provider ).withId( id ); DynamicRecord record = new DynamicRecord( id ); record.setInUse( true ); record.setCreated(); record.setData( SchemaRuleSerialization.serialize( rule ) ); return new SchemaRuleCommand( Collections.emptyList(), singletonList( record ), rule ); }
@Override protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next ) { int id = (int) next.schema(); DynamicRecord recordBefore = new DynamicRecord( id ); DynamicRecord recordAfter = recordBefore.clone(); StoreIndexDescriptor index = forSchema( forLabel( labelId, propertyKeyIds ), DESCRIPTOR ).withId( id ); Collection<DynamicRecord> records = serializeRule( index, recordAfter ); tx.createSchema( singleton( recordBefore ), records, index ); } } );
@Before public void setup() { MutableLongObjectMap<IndexProxy> map = new LongObjectHashMap<>(); map.put( 1L, new TestIndexProxy( forSchema( schema3_4 ).withId( 1 ).withoutCapabilities() ) ); map.put( 2L, new TestIndexProxy( forSchema( schema5_6_7 ).withId( 2 ).withoutCapabilities() ) ); map.put( 3L, new TestIndexProxy( forSchema( schema5_8 ).withId( 3 ).withoutCapabilities() ) ); map.put( 4L, new TestIndexProxy( forSchema( node35_8 ).withId( 4 ).withoutCapabilities() ) ); map.put( 5L, new TestIndexProxy( forSchema( rel35_8 ).withId( 5 ).withoutCapabilities() ) ); indexMap = new IndexMap( map ); }
private StoreIndexDescriptor makeIndexRule( long ruleId, String label, String propertyKey ) { return forSchema( forLabel( labelId( label ), propId( propertyKey ) ), EMPTY.getProviderDescriptor() ).withId( ruleId ); }
@BeforeEach void setUp() { File folder = testDir.directory( "folder" ); PartitionedIndexStorage indexStorage = new PartitionedIndexStorage( dirFactory, fileSystem, folder ); IndexDescriptor descriptor = IndexDescriptorFactory.forSchema( labelSchemaDescriptor ); index = LuceneSchemaIndexBuilder.create( descriptor, Config.defaults() ) .withIndexStorage( indexStorage ) .build(); }
private void assertEqualityByDescriptor( IndexDescriptor descriptor ) { StoreIndexDescriptor rule1 = descriptor.withId( RULE_ID ); StoreIndexDescriptor rule2 = descriptor.withId( RULE_ID_2 ); StoreIndexDescriptor rule3 = (descriptor.type() == Type.GENERAL ? forSchema( descriptor.schema() ) : uniqueForSchema( descriptor.schema() )).withId( RULE_ID ); assertEquality( rule1, rule2 ); assertEquality( rule1, rule3 ); } }