Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.storageengine.api.schema.SchemaRule loadSingleSchemaRule(long ruleId) throws org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException
        public override SchemaRule LoadSingleSchemaRule(long ruleId)
        {
            ICollection <DynamicRecord> records;

            try
            {
                records = _schemaStore.getRecords(ruleId, RecordLoad.NORMAL);
            }
            catch (Exception e)
            {
                throw new MalformedSchemaRuleException(e.Message, e);
            }
            return(SchemaStore.ReadSchemaRule(ruleId, records, NewRecordBuffer()));
        }
Пример #2
0
            protected internal override ReturnType fetchNextOrNull()
            {
                while (currentId <= highestId)
                {
                    long id = currentId++;
                    _outerInstance.schemaStore.getRecord(id, record, RecordLoad.FORCE);
                    if (record.inUse() && record.StartRecord)
                    {
                        // It may be that concurrently to our reading there's a transaction dropping the schema rule
                        // that we're reading and that rule may have spanned multiple dynamic records.
                        try
                        {
                            ICollection <DynamicRecord> records;
                            try
                            {
                                records = _outerInstance.schemaStore.getRecords(id, RecordLoad.NORMAL);
                            }
                            catch (InvalidRecordException)
                            {
                                // This may have been due to a concurrent drop of this rule.
                                continue;
                            }

                            SchemaRule schemaRule = SchemaStore.ReadSchemaRule(id, records, scratchData);
                            if (_returnType.IsInstanceOfType(schemaRule))
                            {
                                ReturnType returnRule = _returnType.cast(schemaRule);
                                if (_predicate(returnRule))
                                {
                                    return(returnRule);
                                }
                            }
                        }
                        catch (MalformedSchemaRuleException e)
                        {
                            if (!_ignoreMalformed)
                            {
                                throw new Exception(e);
                            }
                        }
                    }
                }
                return(null);
            }