protected internal virtual void Create(System.Action <PageCursor> headerWriter)
        {
            lock (this)
            {
                AssertNotDropped();
                AssertNotClosed();

                DeleteFileIfPresent(fileSystem, storeFile);
                instantiateTree(RecoveryCleanupWorkCollector.immediate(), headerWriter);

                // true:  tree uniqueness is (value,entityId)
                // false: tree uniqueness is (value) <-- i.e. more strict
                _mainConflictDetector = MainConflictDetector;
                // for updates we have to have uniqueness on (value,entityId) to allow for intermediary violating updates.
                // there are added conflict checks after updates have been applied.
                _updatesConflictDetector = new ThrowingConflictDetector <KEY, VALUE, Value[]>(true);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void processUpdates(Iterable<? extends org.neo4j.kernel.api.index.IndexEntryUpdate<?>> indexEntryUpdates, ConflictDetectingValueMerger<KEY,VALUE,org.neo4j.values.storable.Value[]> conflictDetector) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        private void ProcessUpdates <T1>(IEnumerable <T1> indexEntryUpdates, ConflictDetectingValueMerger <KEY, VALUE, Value[]> conflictDetector) where T1 : Org.Neo4j.Kernel.Api.Index.IndexEntryUpdate <T1>
        {
            try
            {
                using (Writer <KEY, VALUE> writer = tree.writer())
                {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (org.neo4j.kernel.api.index.IndexEntryUpdate<?> indexEntryUpdate : indexEntryUpdates)
                    foreach (IndexEntryUpdate <object> indexEntryUpdate in indexEntryUpdates)
                    {
                        NativeIndexUpdater.ProcessUpdate(_treeKey, _treeValue, indexEntryUpdate, writer, conflictDetector);
                    }
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
Exemple #3
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();
            }
        }
Exemple #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static <KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> void processAdd(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
        private static void ProcessAdd <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
        {
            InitializeKeyAndValueFromUpdate(treeKey, treeValue, update.EntityId, update.Values());
            conflictDetectingValueMerger.ControlConflictDetection(treeKey);
            writer.Merge(treeKey, treeValue, conflictDetectingValueMerger);
            conflictDetectingValueMerger.CheckConflict(update.Values());
        }
Exemple #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static <KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> void processChange(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
        private static void ProcessChange <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
        {
            // Remove old entry
            InitializeKeyFromUpdate(treeKey, update.EntityId, update.BeforeValues());
            writer.Remove(treeKey);
            // Insert new entry
            InitializeKeyFromUpdate(treeKey, update.EntityId, update.Values());
            treeValue.From(update.Values());
            conflictDetectingValueMerger.ControlConflictDetection(treeKey);
            writer.Merge(treeKey, treeValue, conflictDetectingValueMerger);
            conflictDetectingValueMerger.CheckConflict(update.Values());
        }