示例#1
0
 public override void Receive(StorageNodeCursor node)
 {
     if (node.EntityReference() == 7)
     {
         IndexPopulator.queueUpdate(IndexEntryUpdate.change(8L, Index, Values.of("a"), Values.of("b")));
     }
 }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("ConstantConditions") private <INDEX_KEY extends org.neo4j.internal.kernel.api.schema.SchemaDescriptorSupplier> Iterable<org.neo4j.kernel.api.index.IndexEntryUpdate<INDEX_KEY>> gatherUpdatesForPotentials(Iterable<INDEX_KEY> potentiallyRelevant)
        private IEnumerable <IndexEntryUpdate <INDEX_KEY> > GatherUpdatesForPotentials <INDEX_KEY>(IEnumerable <INDEX_KEY> potentiallyRelevant) where INDEX_KEY : [email protected]
        {
            IList <IndexEntryUpdate <INDEX_KEY> > indexUpdates = new List <IndexEntryUpdate <INDEX_KEY> >();

            foreach (INDEX_KEY indexKey in potentiallyRelevant)
            {
                SchemaDescriptor schema         = indexKey.schema();
                bool             relevantBefore = relevantBefore(schema);
                bool             relevantAfter  = relevantAfter(schema);
                int[]            propertyIds    = Schema.PropertyIds;
                if (relevantBefore && !relevantAfter)
                {
                    indexUpdates.Add(IndexEntryUpdate.remove(_entityId, indexKey, ValuesBefore(propertyIds)));
                }
                else if (!relevantBefore && relevantAfter)
                {
                    indexUpdates.Add(IndexEntryUpdate.add(_entityId, indexKey, ValuesAfter(propertyIds)));
                }
                else if (relevantBefore && relevantAfter)
                {
                    if (ValuesChanged(propertyIds, Schema.propertySchemaType()))
                    {
                        indexUpdates.Add(IndexEntryUpdate.change(_entityId, indexKey, ValuesBefore(propertyIds), ValuesAfter(propertyIds)));
                    }
                }
            }
            return(indexUpdates);
        }
示例#3
0
        private IList <IndexEntryUpdate <SchemaDescriptorSupplier> > GenerateSomeUpdates(int count)
        {
            IList <IndexEntryUpdate <SchemaDescriptorSupplier> > updates = new List <IndexEntryUpdate <SchemaDescriptorSupplier> >();

            for (int i = 0; i < count; i++)
            {
                long entityId = Random.nextLong(10_000_000);
                switch (Random.among(UpdateMode.MODES))
                {
                case ADDED:
                    updates.Add(IndexEntryUpdate.add(entityId, _descriptor, Random.nextValue()));
                    break;

                case REMOVED:
                    updates.Add(IndexEntryUpdate.remove(entityId, _descriptor, Random.nextValue()));
                    break;

                case CHANGED:
                    updates.Add(IndexEntryUpdate.change(entityId, _descriptor, Random.nextValue(), Random.nextValue()));
                    break;

                default:
                    throw new System.ArgumentException();
                }
            }
            return(updates);
        }
示例#4
0
 internal virtual void Add <T1>(IndexEntryUpdate <T1> update)
 {
     if (update.EntityId == 2)
     {
         JobConflict.update(IndexEntryUpdate.change(NodeToChange, Index, PreviousValue, NewValue));
     }
     Added.Add(Pair.of(update.EntityId, update.Values()[0].asObjectCopy()));
 }
示例#5
0
        private static IndexEntryUpdate <SchemaDescriptorSupplier> AsUpdate(IndexUpdateCursor <GenericKey, NativeIndexValue> reader)
        {
            switch (reader.UpdateMode())
            {
            case ADDED:
                return(IndexEntryUpdate.add(reader.Key().EntityId, _descriptor, reader.Key().asValue()));

            case CHANGED:
                return(IndexEntryUpdate.change(reader.Key().EntityId, _descriptor, reader.Key().asValue(), reader.Key2().asValue()));

            case REMOVED:
                return(IndexEntryUpdate.remove(reader.Key().EntityId, _descriptor, reader.Key().asValue()));

            default:
                throw new System.ArgumentException();
            }
        }
示例#6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotThrowOnDuplicationsLaterFixedByExternalUpdates() throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotThrowOnDuplicationsLaterFixedByExternalUpdates()
        {
            // given
            BlockBasedIndexPopulator <GenericKey, NativeIndexValue> populator = InstantiatePopulator(_uniqueIndexDescriptor);
            bool closed = false;

            try
            {
                // when
                Value duplicate = Values.of("duplicate");
                Value unique    = Values.of("unique");
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> firstScanUpdate = org.neo4j.kernel.api.index.IndexEntryUpdate.add(1, INDEX_DESCRIPTOR, duplicate);
                IndexEntryUpdate <object> firstScanUpdate = IndexEntryUpdate.add(1, _indexDescriptor, duplicate);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> secondScanUpdate = org.neo4j.kernel.api.index.IndexEntryUpdate.add(2, INDEX_DESCRIPTOR, duplicate);
                IndexEntryUpdate <object> secondScanUpdate = IndexEntryUpdate.add(2, _indexDescriptor, duplicate);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> externalUpdate = org.neo4j.kernel.api.index.IndexEntryUpdate.change(1, INDEX_DESCRIPTOR, duplicate, unique);
                IndexEntryUpdate <object> externalUpdate = IndexEntryUpdate.change(1, _indexDescriptor, duplicate, unique);
                populator.Add(singleton(firstScanUpdate));
                using (IndexUpdater updater = populator.NewPopulatingUpdater())
                {
                    updater.Process(externalUpdate);
                }
                populator.Add(singleton(secondScanUpdate));
                populator.ScanCompleted(nullInstance);

                // then
                AssertHasEntry(populator, unique, 1);
                AssertHasEntry(populator, duplicate, 2);
            }
            finally
            {
                if (!closed)
                {
                    populator.Close(true);
                }
            }
        }
示例#7
0
 internal static IndexEntryUpdate <LabelSchemaDescriptor> Change(Value before, Value after)
 {
     return(IndexEntryUpdate.change(0, _indexKey, before, after));
 }