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());
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnIndexRuleForLabelAndVeryManyPropertiesComposite()
        public virtual void ShouldReturnIndexRuleForLabelAndVeryManyPropertiesComposite()
        {
            string[] props = "abcdefghijklmnopqrstuvwxyzABCDEFGHJILKMNOPQRSTUVWXYZ".Split("\\B", true);
            CreateSchema(Db =>
            {
                IndexCreator indexCreator = Db.schema().indexFor(Label.label(LABEL1));
                foreach (string prop in props)
                {
                    indexCreator = indexCreator.on(prop);
                }
                indexCreator.create();
            });

            StoreIndexDescriptor rule = _storage.indexGetForSchema(TestIndexDescriptorFactory.forLabel(LabelId(LABEL1), java.util.props.Select(this.propId).ToArray()));

            assertNotNull(rule);
            assertTrue(SchemaDescriptorPredicates.hasLabel(rule, LabelId(LABEL1)));
            foreach (string prop in props)
            {
                assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(prop)));
            }
            assertEquals(IndexDescriptor.Type.GENERAL, rule.Type());
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnIndexRuleForLabelAndPropertyComposite()
        public virtual void ShouldReturnIndexRuleForLabelAndPropertyComposite()
        {
            string a = "a";
            string b = "b";
            string c = "c";
            string d = "d";
            string e = "e";
            string f = "f";

            CreateSchema(Db => Db.schema().indexFor(Label.label(LABEL1)).on(a).on(b).on(c).on(d).on(e).on(f).create());

            StoreIndexDescriptor rule = _storage.indexGetForSchema(TestIndexDescriptorFactory.forLabel(LabelId(LABEL1), PropId(a), PropId(b), PropId(c), PropId(d), PropId(e), PropId(f)));

            assertNotNull(rule);
            assertTrue(SchemaDescriptorPredicates.hasLabel(rule, LabelId(LABEL1)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(a)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(b)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(c)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(d)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(e)));
            assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(f)));
            assertEquals(IndexDescriptor.Type.GENERAL, rule.Type());
        }
Beispiel #4
0
 private void AssertRule(StoreIndexDescriptor rule, string label, string propertyKey, IndexDescriptor.Type type)
 {
     assertTrue(SchemaDescriptorPredicates.hasLabel(rule, LabelId(label)));
     assertTrue(SchemaDescriptorPredicates.hasProperty(rule, PropId(propertyKey)));
     assertEquals(type, rule.Type());
 }