Search in sources :

Example 1 with AddedAndRemoved

use of org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved in project neo4j by neo4j.

the class TxStateIndexChangesTest method assertScanWithOrder.

private void assertScanWithOrder(IndexOrder indexOrder) {
    // GIVEN
    final ReadableTransactionState state = new TxStateBuilder().withAdded(40L, "Aaron").withAdded(41L, "Agatha").withAdded(42L, "Andreas").withAdded(43L, "Barbarella").withAdded(44L, "Andrea").withAdded(45L, "Aristotle").withAdded(46L, "Barbara").withAdded(47L, "Cinderella").build();
    // WHEN
    AddedAndRemoved changes = indexUpdatesForScan(state, index, indexOrder);
    AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForScan(state, index, indexOrder);
    EntityWithPropertyValues[] expectedEntitiesWithValues = { entityWithPropertyValues(40L, "Aaron"), entityWithPropertyValues(41L, "Agatha"), entityWithPropertyValues(44L, "Andrea"), entityWithPropertyValues(42L, "Andreas"), entityWithPropertyValues(45L, "Aristotle"), entityWithPropertyValues(46L, "Barbara"), entityWithPropertyValues(43L, "Barbarella"), entityWithPropertyValues(47L, "Cinderella") };
    // THEN
    assertContains(indexOrder, changes, changesWithValues, expectedEntitiesWithValues);
}
Also used : AddedWithValuesAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedWithValuesAndRemoved) ReadableTransactionState(org.neo4j.storageengine.api.txstate.ReadableTransactionState) AddedAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved)

Example 2 with AddedAndRemoved

use of org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved in project neo4j by neo4j.

the class DefaultEntityValueIndexCursor method seekQuery.

private void seekQuery(IndexDescriptor descriptor, Value[] values) {
    TransactionState txState = read.txState();
    if (needsValues) {
        AddedWithValuesAndRemoved changes = indexUpdatesWithValuesForSeek(txState, descriptor, ValueTuple.of(values));
        addedWithValues = changes.getAdded().iterator();
        removed = removed(txState, changes.getRemoved());
    } else {
        AddedAndRemoved changes = indexUpdatesForSeek(txState, descriptor, ValueTuple.of(values));
        added = changes.getAdded().longIterator();
        removed = removed(txState, changes.getRemoved());
    }
}
Also used : TransactionState(org.neo4j.kernel.api.txstate.TransactionState) AddedWithValuesAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedWithValuesAndRemoved) AddedAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved)

Example 3 with AddedAndRemoved

use of org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved in project neo4j by neo4j.

the class DefaultEntityValueIndexCursor method suffixOrContainsQuery.

private void suffixOrContainsQuery(IndexDescriptor descriptor, PropertyIndexQuery query) {
    TransactionState txState = read.txState();
    if (needsValues) {
        AddedWithValuesAndRemoved changes = indexUpdatesWithValuesForSuffixOrContains(txState, descriptor, query, indexOrder);
        addedWithValues = changes.getAdded().iterator();
        removed = removed(txState, changes.getRemoved());
    } else {
        AddedAndRemoved changes = indexUpdatesForSuffixOrContains(txState, descriptor, query, indexOrder);
        added = changes.getAdded().longIterator();
        removed = removed(txState, changes.getRemoved());
    }
}
Also used : TransactionState(org.neo4j.kernel.api.txstate.TransactionState) AddedWithValuesAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedWithValuesAndRemoved) AddedAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved)

Example 4 with AddedAndRemoved

use of org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved in project neo4j by neo4j.

the class DefaultEntityValueIndexCursor method rangeQuery.

private void rangeQuery(IndexDescriptor descriptor, Value[] equalityPrefix, PropertyIndexQuery.RangePredicate<?> predicate) {
    TransactionState txState = read.txState();
    if (needsValues) {
        AddedWithValuesAndRemoved changes = indexUpdatesWithValuesForRangeSeek(txState, descriptor, equalityPrefix, predicate, indexOrder);
        addedWithValues = changes.getAdded().iterator();
        removed = removed(txState, changes.getRemoved());
    } else {
        AddedAndRemoved changes = indexUpdatesForRangeSeek(txState, descriptor, equalityPrefix, predicate, indexOrder);
        added = changes.getAdded().longIterator();
        removed = removed(txState, changes.getRemoved());
    }
}
Also used : TransactionState(org.neo4j.kernel.api.txstate.TransactionState) AddedWithValuesAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedWithValuesAndRemoved) AddedAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved)

Example 5 with AddedAndRemoved

use of org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved in project neo4j by neo4j.

the class DefaultEntityValueIndexCursor method scanQuery.

private void scanQuery(IndexDescriptor descriptor) {
    TransactionState txState = read.txState();
    if (needsValues) {
        AddedWithValuesAndRemoved changes = indexUpdatesWithValuesForScan(txState, descriptor, indexOrder);
        addedWithValues = changes.getAdded().iterator();
        removed = removed(txState, changes.getRemoved());
    } else {
        AddedAndRemoved changes = indexUpdatesForScan(txState, descriptor, indexOrder);
        added = changes.getAdded().longIterator();
        removed = removed(txState, changes.getRemoved());
    }
}
Also used : TransactionState(org.neo4j.kernel.api.txstate.TransactionState) AddedWithValuesAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedWithValuesAndRemoved) AddedAndRemoved(org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved)

Aggregations

AddedAndRemoved (org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedAndRemoved)10 AddedWithValuesAndRemoved (org.neo4j.kernel.impl.newapi.TxStateIndexChanges.AddedWithValuesAndRemoved)9 TransactionState (org.neo4j.kernel.api.txstate.TransactionState)5 ReadableTransactionState (org.neo4j.storageengine.api.txstate.ReadableTransactionState)4 DynamicTest (org.junit.jupiter.api.DynamicTest)3 Test (org.junit.jupiter.api.Test)3