public void process <T1>(IndexEntryUpdate <T1> update)
                {
                    switch (update.UpdateMode())
                    {
                    case ADDED:
                    case CHANGED:
                        _outerInstance.added.Add(Pair.of(update.EntityId, update.Values()[0].asObjectCopy()));
                        break;

                    default:
                        throw new System.ArgumentException(update.UpdateMode().name());
                    }
                }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void process(org.neo4j.kernel.api.index.IndexEntryUpdate<?> update) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void Process <T1>(IndexEntryUpdate <T1> update)
        {
            IndexUpdater to = Select(update.Values()[0].valueGroup());

            switch (update.UpdateMode())
            {
            case ADDED:
            case REMOVED:
                to.Process(update);
                break;

            case CHANGED:
                IndexUpdater from = Select(update.BeforeValues()[0].valueGroup());
                // There are two cases:
                // - both before/after go into the same updater --> pass update into that updater
                if (from == to)
                {
                    from.Process(update);
                }
                // - before go into one and after into the other --> REMOVED from one and ADDED into the other
                else
                {
                    from.Process(IndexEntryUpdate.remove(update.EntityId, update.IndexKey(), update.BeforeValues()));
                    to.Process(IndexEntryUpdate.add(update.EntityId, update.IndexKey(), update.Values()));
                }
                break;

            default:
                throw new System.ArgumentException("Unknown update mode");
            }
        }
Beispiel #3
0
        public override void Process <T1>(IndexEntryUpdate <T1> update)
        {
            long nodeId = update.EntityId;

            try
            {
                switch (update.UpdateMode())
                {
                case ADDED:
                    Added(update);
                    _writer.updateDocument(LuceneDocumentStructure.newTermForChangeOrRemove(nodeId), LuceneDocumentStructure.documentRepresentingProperties(nodeId, update.Values()));
                    break;

                case CHANGED:
                    Changed(update);
                    _writer.updateDocument(LuceneDocumentStructure.newTermForChangeOrRemove(nodeId), LuceneDocumentStructure.documentRepresentingProperties(nodeId, update.Values()));
                    break;

                case REMOVED:
                    Removed(update);
                    _writer.deleteDocuments(LuceneDocumentStructure.newTermForChangeOrRemove(nodeId));
                    break;

                default:
                    throw new System.InvalidOperationException("Unknown update mode " + Arrays.ToString(update.Values()));
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
Beispiel #4
0
            public override void Process <T1>(IndexEntryUpdate <T1> update)
            {
                // we do not support adding partial entries
                Debug.Assert(update.IndexKey().schema().Equals(outerInstance.Descriptor.schema()));

                switch (update.UpdateMode())
                {
                case ADDED:
                    if (Idempotent)
                    {
                        AddIdempotent(update.EntityId, update.Values());
                    }
                    else
                    {
                        Add(update.EntityId, update.Values());
                    }
                    break;

                case CHANGED:
                    Change(update.EntityId, update.Values());
                    break;

                case REMOVED:
                    Remove(update.EntityId);
                    break;

                default:
                    throw new System.NotSupportedException();
                }
                HasChanges = true;
            }
            public override void Process <T1>(IndexEntryUpdate <T1> update)
            {
                Debug.Assert(update.IndexKey().schema().Equals(outerInstance.descriptor.Schema()));
                try
                {
                    switch (update.UpdateMode())
                    {
                    case ADDED:
                        long nodeId = update.EntityId;
                        outerInstance.LuceneIndex.IndexWriter.updateDocument(LuceneFulltextDocumentStructure.NewTermForChangeOrRemove(nodeId), LuceneFulltextDocumentStructure.DocumentRepresentingProperties(nodeId, outerInstance.descriptor.PropertyNames(), update.Values()));

                        goto case CHANGED;

                    case CHANGED:
                        long nodeId1 = update.EntityId;
                        outerInstance.LuceneIndex.IndexWriter.updateDocument(LuceneFulltextDocumentStructure.NewTermForChangeOrRemove(nodeId1), LuceneFulltextDocumentStructure.DocumentRepresentingProperties(nodeId1, outerInstance.descriptor.PropertyNames(), update.Values()));
                        break;

                    case REMOVED:
                        outerInstance.LuceneIndex.IndexWriter.deleteDocuments(LuceneFulltextDocumentStructure.NewTermForChangeOrRemove(update.EntityId));
                        break;

                    default:
                        throw new System.NotSupportedException();
                    }
                }
                catch (IOException e)
                {
                    throw new UncheckedIOException(e);
                }
            }
Beispiel #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void add(org.neo4j.kernel.api.index.IndexEntryUpdate<?> update, org.neo4j.io.pagecache.PageCursor pageCursor) throws java.io.IOException
        public override void Add <T1>(IndexEntryUpdate <T1> update, PageCursor pageCursor)
        {
            int        entrySize  = TYPE_SIZE;
            UpdateMode updateMode = update.UpdateMode();

            switch (updateMode.innerEnumValue)
            {
            case UpdateMode.InnerEnum.ADDED:
                initializeKeyAndValueFromUpdate(_key1, _value, update.EntityId, update.Values());
                entrySize += BlockEntry.EntrySize(_layout, _key1, _value);
                break;

            case UpdateMode.InnerEnum.REMOVED:
                initializeKeyFromUpdate(_key1, update.EntityId, update.Values());
                entrySize += BlockEntry.KeySize(_layout, _key1);
                break;

            case UpdateMode.InnerEnum.CHANGED:
                initializeKeyFromUpdate(_key1, update.EntityId, update.BeforeValues());
                initializeKeyAndValueFromUpdate(_key2, _value, update.EntityId, update.Values());
                entrySize += BlockEntry.KeySize(_layout, _key1) + BlockEntry.EntrySize(_layout, _key2, _value);
                break;

            default:
                throw new System.ArgumentException("Unknown update mode " + updateMode);
            }

            prepareWrite(entrySize);

            pageCursor.PutByte(( sbyte )updateMode.ordinal());
            IndexUpdateEntry.Write(pageCursor, _layout, updateMode, _key1, _key2, _value);
        }
Beispiel #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void process(org.neo4j.kernel.api.index.IndexEntryUpdate<?> update) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void Process <T1>(IndexEntryUpdate <T1> update)
        {
            _actual.process(update);
            if (update.UpdateMode() != REMOVED)
            {
                _touchedTuples.Add(ValueTuple.of(update.Values()));
            }
        }
                public void process <T1>(IndexEntryUpdate <T1> update)
                {
                    switch (update.UpdateMode())
                    {
                    case ADDED:
                    case CHANGED:
                        _outerInstance.added[update.EntityId] = update.Values()[0].asObjectCopy();
                        break;

                    case REMOVED:
                        _outerInstance.removed[update.EntityId] = update.Values()[0].asObjectCopy();                                           // on remove, value is the before value
                        break;

                    default:
                        throw new System.ArgumentException(update.UpdateMode().name());
                    }
                }
        private void UpdateUniqueSample <T1>(IndexEntryUpdate <T1> update)
        {
            switch (update.UpdateMode())
            {
            case ADDED:
                _uniqueSampler.increment(1);
                break;

            case REMOVED:
                _uniqueSampler.increment(-1);
                break;

            case CHANGED:
                break;

            default:
                throw new System.ArgumentException("Unsupported update mode type:" + update.UpdateMode());
            }
        }
Beispiel #10
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static <KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> void processUpdate(KEY treeKey, VALUE treeValue, org.neo4j.kernel.api.index.IndexEntryUpdate<?> update, org.neo4j.index.internal.gbptree.Writer<KEY,VALUE> writer, ConflictDetectingValueMerger<KEY,VALUE,org.neo4j.values.storable.Value[]> conflictDetectingValueMerger) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        internal static void ProcessUpdate <KEY, VALUE, T1>(KEY treeKey, VALUE treeValue, IndexEntryUpdate <T1> update, Writer <KEY, VALUE> writer, ConflictDetectingValueMerger <KEY, VALUE, Value[]> conflictDetectingValueMerger) where KEY : NativeIndexKey <KEY> where VALUE : NativeIndexValue
        {
            switch (update.UpdateMode())
            {
            case ADDED:
                ProcessAdd(treeKey, treeValue, update, writer, conflictDetectingValueMerger);
                break;

            case CHANGED:
                ProcessChange(treeKey, treeValue, update, writer, conflictDetectingValueMerger);
                break;

            case REMOVED:
                ProcessRemove(treeKey, update, writer);
                break;

            default:
                throw new System.ArgumentException();
            }
        }
Beispiel #11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void process(org.neo4j.kernel.api.index.IndexEntryUpdate<?> update) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void Process <T1>(IndexEntryUpdate <T1> update)
        {
            PointValue value = ( PointValue )update.Values()[0];

            switch (update.UpdateMode())
            {
            case ADDED:
                Select(value.CoordinateReferenceSystem).process(update);
                break;

            case CHANGED:
                // These are both spatial, but could belong in different parts
                PointValue   fromValue = ( PointValue )update.BeforeValues()[0];
                IndexUpdater from      = Select(fromValue.CoordinateReferenceSystem);
                IndexUpdater to        = Select(value.CoordinateReferenceSystem);
                // There are two cases:
                // - both before/after go into the same updater --> pass update into that updater
                if (from == to)
                {
                    from.Process(update);
                }
                // - before go into one and after into the other --> REMOVED from one and ADDED into the other
                else
                {
                    from.Process(IndexEntryUpdate.remove(update.EntityId, update.IndexKey(), update.BeforeValues()));
                    to.Process(IndexEntryUpdate.add(update.EntityId, update.IndexKey(), update.Values()));
                }
                break;

            case REMOVED:
                Select(value.CoordinateReferenceSystem).process(update);
                break;

            default:
                throw new System.ArgumentException("Unknown update mode");
            }
        }
Beispiel #12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void process(org.neo4j.kernel.api.index.IndexEntryUpdate<?> update) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void Process <T1>(IndexEntryUpdate <T1> update)
        {
            switch (update.UpdateMode())
            {
            case ADDED:
                InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf)).process(update);
                break;

            case CHANGED:
                // Hmm, here's a little conundrum. What if we change from a value that goes into native
                // to a value that goes into fallback, or vice versa? We also don't want to blindly pass
                // all CHANGED updates to both updaters since not all values will work in them.
                IndexUpdater from = InstanceSelector.select(SlotSelector.selectSlot(update.BeforeValues(), GroupOf));
                IndexUpdater to   = InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf));
                // There are two cases:
                // - both before/after go into the same updater --> pass update into that updater
                if (from == to)
                {
                    from.Process(update);
                }
                // - before go into one and after into the other --> REMOVED from one and ADDED into the other
                else
                {
                    from.Process(IndexEntryUpdate.remove(update.EntityId, update.IndexKey(), update.BeforeValues()));
                    to.Process(IndexEntryUpdate.add(update.EntityId, update.IndexKey(), update.Values()));
                }
                break;

            case REMOVED:
                InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf)).process(update);
                break;

            default:
                throw new System.ArgumentException("Unknown update mode");
            }
        }