예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.cursor.RawCursor<org.neo4j.index.internal.gbptree.Hit<KEY,VALUE>, java.io.IOException> scan(org.neo4j.index.internal.gbptree.GBPTree<KEY,VALUE> tree) throws java.io.IOException
        private RawCursor <Hit <KEY, VALUE>, IOException> Scan(GBPTree <KEY, VALUE> tree)
        {
            KEY lowest = Layout.newKey();

            lowest.initialize(long.MinValue);
            lowest.initValueAsLowest(0, ValueGroup.UNKNOWN);
            KEY highest = Layout.newKey();

            highest.initialize(long.MaxValue);
            highest.initValueAsHighest(0, ValueGroup.UNKNOWN);
            return(tree.Seek(lowest, highest));
        }
예제 #2
0
        public override IndexSample Result()
        {
            KEY lowest = _layout.newKey();

            lowest.initialize(long.MinValue);
            lowest.initValuesAsLowest();
            KEY highest = _layout.newKey();

            highest.initialize(long.MaxValue);
            highest.initValuesAsHighest();
            KEY prev = _layout.newKey();

            try
            {
                using (RawCursor <Hit <KEY, VALUE>, IOException> seek = _gbpTree.seek(lowest, highest))
                {
                    long sampledValues = 0;
                    long uniqueValues  = 0;

                    // Get the first one so that prev gets initialized
                    if (seek.Next())
                    {
                        prev = _layout.copyKey(seek.get().key(), prev);
                        sampledValues++;
                        uniqueValues++;

                        // Then do the rest
                        while (seek.Next())
                        {
                            Hit <KEY, VALUE> hit = seek.get();
                            if (_layout.compareValue(prev, hit.Key()) != 0)
                            {
                                uniqueValues++;
                                _layout.copyKey(hit.Key(), prev);
                            }
                            // else this is a duplicate of the previous one
                            sampledValues++;
                        }
                    }
                    return(new IndexSample(sampledValues, uniqueValues, sampledValues));
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void verify(org.neo4j.storageengine.api.NodePropertyAccessor nodePropertyAccessor, IndexLayout<SpatialIndexKey,NativeIndexValue> layout, org.neo4j.index.internal.gbptree.GBPTree<SpatialIndexKey,NativeIndexValue> tree, org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        internal static void Verify(NodePropertyAccessor nodePropertyAccessor, IndexLayout <SpatialIndexKey, NativeIndexValue> layout, GBPTree <SpatialIndexKey, NativeIndexValue> tree, StoreIndexDescriptor descriptor)
        {
            SpatialIndexKey from = layout.newKey();
            SpatialIndexKey to   = layout.newKey();

            InitializeKeys(from, to);
            try
            {
                using (RawCursor <Hit <SpatialIndexKey, NativeIndexValue>, IOException> seek = tree.Seek(from, to))
                {
                    ScanAndVerifyDuplicates(nodePropertyAccessor, descriptor, seek);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
예제 #4
0
        public override long CountIndexedNodes(long nodeId, int[] propertyKeyIds, params Value[] propertyValues)
        {
            KEY treeKeyFrom = Layout.newKey();
            KEY treeKeyTo   = Layout.newKey();

            treeKeyFrom.initialize(nodeId);
            treeKeyTo.initialize(nodeId);
            for (int i = 0; i < propertyValues.Length; i++)
            {
                treeKeyFrom.initFromValue(i, propertyValues[i], NEUTRAL);
                treeKeyTo.initFromValue(i, propertyValues[i], NEUTRAL);
            }
            try
            {
                using (RawCursor <Hit <KEY, VALUE>, IOException> seeker = Tree.seek(treeKeyFrom, treeKeyTo))
                {
                    long count = 0;
                    while (seeker.Next())
                    {
                        if (seeker.get().key().EntityId == nodeId)
                        {
                            count++;
                        }
                    }
                    return(count);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
예제 #5
0
        internal NativeIndexPopulator(PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout <KEY, VALUE> layout, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, System.Action <PageCursor> additionalHeaderWriter) : base(pageCache, fs, storeFile, layout, monitor, descriptor, false)
        {
            this._treeKey   = layout.newKey();
            this._treeValue = layout.NewValue();
            this._additionalHeaderWriter = additionalHeaderWriter;
            switch (descriptor.Type())
            {
            case GENERAL:
                _uniqueSampler = null;
                break;

            case UNIQUE:
                _uniqueSampler = new UniqueIndexSampler();
                break;

            default:
                throw new System.ArgumentException("Unexpected index type " + descriptor.Type());
            }
        }
예제 #6
0
 internal NativeDistinctValuesProgressor(RawCursor <Hit <KEY, VALUE>, IOException> seeker, Org.Neo4j.Storageengine.Api.schema.IndexProgressor_NodeValueClient client, ICollection <RawCursor <Hit <KEY, VALUE>, IOException> > toRemoveFromOnClose, IndexLayout <KEY, VALUE> layout, IComparer <KEY> comparator) : base(seeker, client, toRemoveFromOnClose)
 {
     this._layout     = layout;
     _prev            = layout.newKey();
     this._comparator = comparator;
 }
예제 #7
0
 internal NativeIndexAccessor(PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout <KEY, VALUE> layout, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, System.Action <PageCursor> additionalHeaderWriter, bool readOnly) : base(pageCache, fs, storeFile, layout, monitor, descriptor, readOnly)
 {
     _singleUpdater = new NativeIndexUpdater <KEY, VALUE>(layout.newKey(), layout.NewValue());
     HeaderWriter   = new NativeIndexHeaderWriter(BYTE_ONLINE, additionalHeaderWriter);
 }