Beispiel #1
0
        public WriteGroupsStage(Configuration config, RelationshipGroupCache cache, RecordStore <RelationshipGroupRecord> store) : base(NAME, null, config, 0)
        {
            Add(new ReadGroupsFromCacheStep(Control(), config, cache.GetEnumerator(), GROUP_ENTRY_SIZE));
            Add(new EncodeGroupsStep(Control(), config, store));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new UpdateRecordsStep<>(control(), config, store, new org.neo4j.unsafe.impl.batchimport.store.StorePrepareIdSequence()));
            Add(new UpdateRecordsStep <object>(Control(), config, store, new StorePrepareIdSequence()));
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the Java 'super' constraint:
//ORIGINAL LINE: Scan(RecordStore<R> store, boolean forward, final System.Predicate<? super R>... filters)
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
			  internal Scan( RecordStore<R> store, bool forward, params System.Predicate<object>[] filters )
			  {
					this.Filters = filters;
					this.Ids = new StoreIdIterator( store, forward );
					this.Store = store;
					this.Cursor = store.OpenPageCursorForReading( 0 );
					this.Record = store.NewRecord();
			  }
        public ScanAndCacheGroupsStage(Configuration config, RecordStore <RelationshipGroupRecord> store, RelationshipGroupCache cache, params StatsProvider[] additionalStatsProviders) : base(NAME, null, config, RECYCLE_BATCHES)
        {
            Add(new BatchFeedStep(Control(), config, allInReversed(store, config), store.RecordSize));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new org.neo4j.unsafe.impl.batchimport.staging.ReadRecordsStep<>(control(), config, false, store));
            Add(new ReadRecordsStep <object>(Control(), config, false, store));
            Add(new CacheGroupsStep(Control(), config, cache, additionalStatsProviders));
        }
        /// <summary>
        /// Initializes states for specified map and record.
        /// </summary>
        public void Setup(IPlayableMap map, IRecord record, bool allowRetry = true)
        {
            allowsRetry.Value = allowRetry;

            SetMap(map);
            SetRecord(record);

            hasReplay.Value = RecordStore.HasReplayData(record);
        }
        public WhenComparingLists()
        {
            IRecordStore recordStore = new RecordStore();

            recordStore.Add("Purple Rain");
            recordStore.Add("Around The World In A Day");
            recordStore.Add("Parade");
            _albumTitles = recordStore.GetAlbumTitles().ToList().AsReadOnly();
        }
Beispiel #6
0
 internal StoreProcessorTask(string name, Statistics statistics, int threads, RecordStore <R> store, StoreAccess storeAccess, string builderPrefix, ProgressMonitorFactory.MultiPartBuilder builder, CacheAccess cacheAccess, StoreProcessor processor, QueueDistribution distribution) : base(name, statistics, threads)
 {
     this._store            = store;
     this._storeAccess      = storeAccess;
     this._cacheAccess      = cacheAccess;
     this._processor        = processor;
     this._distribution     = distribution;
     this._progressListener = builder.ProgressForPart(name + IndexedPartName(store.StorageFile.Name, builderPrefix), store.HighId);
 }
Beispiel #7
0
        public List <Record> returnRecord()
        {
            var recordStore = new RecordStore()
            {
                Path = recordPath
            };
            var recordList = recordStore.GetCollection();

            return(recordList);
        }
        /// <summary>
        /// Starts loading the record data.
        /// </summary>
        private void LoadRecordData()
        {
            SetState("Loading record data");

            TaskListener listener = new TaskListener();

            listener.OnProgress += SetProgress;
            listener.OnFinished += FinalizeLoad;
            RecordStore.Reload(listener);
        }
        public static RecordStore <DynamicRecord> ConfigureDynamicStore(int blockSize)
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") org.neo4j.kernel.impl.store.RecordStore<org.neo4j.kernel.impl.store.record.DynamicRecord> mock = mock(org.neo4j.kernel.impl.store.RecordStore.class);
            RecordStore <DynamicRecord> mock = mock(typeof(RecordStore));

            when(mock.RecordSize).thenReturn(blockSize + DynamicRecordFormat.RECORD_HEADER_SIZE);
            when(mock.RecordDataSize).thenReturn(blockSize);
            return(mock);
        }
Beispiel #10
0
 public override void ProcessSchema(RecordStore <DynamicRecord> store, DynamicRecord schema)
 {
     if (null == _schemaRecordCheck)
     {
         base.ProcessSchema(store, schema);
     }
     else
     {
         CheckSchema(RecordType.SCHEMA, store, schema, _schemaRecordCheck);
     }
 }
 public override void ProcessNode(RecordStore <NodeRecord> store, NodeRecord node)
 {
     if (node.Dense)
     {
         CheckNode(store, node, _denseNodeChecker);
     }
     else
     {
         CheckNode(store, node, _sparseNodeChecker);
     }
 }
Beispiel #12
0
 public Loaders(RecordStore <NodeRecord> nodeStore, PropertyStore propertyStore, RecordStore <RelationshipRecord> relationshipStore, RecordStore <RelationshipGroupRecord> relationshipGroupStore, RecordStore <PropertyKeyTokenRecord> propertyKeyTokenStore, RecordStore <RelationshipTypeTokenRecord> relationshipTypeTokenStore, RecordStore <LabelTokenRecord> labelTokenStore, SchemaStore schemaStore)
 {
     _nodeLoader                  = _nodeLoader(nodeStore);
     _propertyLoader              = _propertyLoader(propertyStore);
     _relationshipLoader          = _relationshipLoader(relationshipStore);
     _relationshipGroupLoader     = _relationshipGroupLoader(relationshipGroupStore);
     _schemaRuleLoader            = _schemaRuleLoader(schemaStore);
     _propertyKeyTokenLoader      = _propertyKeyTokenLoader(propertyKeyTokenStore);
     _labelTokenLoader            = _labelTokenLoader(labelTokenStore);
     _relationshipTypeTokenLoader = _relationshipTypeTokenLoader(relationshipTypeTokenStore);
 }
Beispiel #13
0
        public IHttpActionResult GetTags([FromODataUri] int recordStoreId)
        {
            RecordStore recordStore = dbContext.RecordStores.FirstOrDefault(r => r.RecordStoreId == recordStoreId);

            if (recordStore == null)
            {
                return(NotFound());
            }

            return(Ok(recordStore.Tags));
        }
Beispiel #14
0
        private static void Migrate <RECORD>(RecordStore <RECORD> from, RecordStore <RECORD> to) where RECORD : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord
        {
            to.HighestPossibleIdInUse = from.HighestPossibleIdInUse;

            from.ScanAllRecords(record =>
            {
                to.PrepareForCommit(record);
                to.UpdateRecord(record);
                return(false);
            });
        }
Beispiel #15
0
        public NodeFirstGroupStage(Configuration config, RecordStore <RelationshipGroupRecord> groupStore, NodeStore nodeStore, ByteArray cache) : base(NAME, null, config, 0)
        {
            Add(new BatchFeedStep(Control(), config, allIn(groupStore, config), groupStore.RecordSize));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new org.neo4j.unsafe.impl.batchimport.staging.ReadRecordsStep<>(control(), config, true, groupStore));
            Add(new ReadRecordsStep <object>(Control(), config, true, groupStore));
            Add(new NodeSetFirstGroupStep(Control(), config, nodeStore, cache));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new UpdateRecordsStep<>(control(), config, nodeStore, new org.neo4j.unsafe.impl.batchimport.store.StorePrepareIdSequence()));
            Add(new UpdateRecordsStep <object>(Control(), config, nodeStore, new StorePrepareIdSequence()));
        }
Beispiel #16
0
 private void FlushIdFiles(NeoStores neoStores, StoreType[] storeTypes)
 {
     foreach (StoreType type in storeTypes)
     {
         if (type.RecordStore)
         {
             RecordStore <AbstractBaseRecord> recordStore = neoStores.GetRecordStore(type);
             Optional <File> idFile = _databaseLayout.idFile(type.DatabaseFile);
             idFile.ifPresent(f => _idGeneratorFactory.create(f, recordStore.HighId, false));
         }
     }
 }
Beispiel #17
0
        private static T[] ReadAllRecords <T>(Type type, RecordStore <T> store) where T : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord
        {
            type = typeof(T);
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") T[] records = (T[]) Array.newInstance(type, (int) store.getHighId());
            T[] records = ( T[] )Array.CreateInstance(type, ( int )store.HighId);
            for (int i = 0; i < records.Length; i++)
            {
                records[i] = store.GetRecord(i, store.NewRecord(), FORCE);
            }
            return(records);
        }
Beispiel #18
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public <R extends org.neo4j.kernel.impl.store.record.AbstractBaseRecord> void applyFilteredParallel(final org.neo4j.kernel.impl.store.RecordStore<R> store, final org.neo4j.helpers.progress.ProgressListener progressListener, int numberOfThreads, long recordsPerCpu, final org.neo4j.consistency.checking.full.QueueDistribution_QueueDistributor<R> distributor)
        public virtual void ApplyFilteredParallel <R>(RecordStore <R> store, ProgressListener progressListener, int numberOfThreads, long recordsPerCpu, QueueDistribution_QueueDistributor <R> distributor) where R : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord
        {
            CacheAccess.prepareForProcessingOfSingleStore(recordsPerCpu);
            RecordProcessor <R> processor = new RecordProcessor_AdapterAnonymousInnerClass(this, store);

            ResourceIterable <R> scan = scan(store, _stage.Forward);

            using (ResourceIterator <R> records = scan.GetEnumerator())
            {
                distributeRecords(numberOfThreads, this.GetType().Name, _qSize, cloned(records), progressListener, processor, distributor);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLoadAllConnectedRelationshipRecordsAndTheirFullChainsOfRelationshipRecords()
        public virtual void ShouldLoadAllConnectedRelationshipRecordsAndTheirFullChainsOfRelationshipRecords()
        {
            // given
            RecordStore <RelationshipRecord> relationshipStore = _store.RelationshipStore;

            // when
            int relationshipIdInMiddleOfChain      = 10;
            RecordSet <RelationshipRecord> records = (new RelationshipChainExplorer(relationshipStore)).ExploreRelationshipRecordChainsToDepthTwo(relationshipStore.GetRecord(relationshipIdInMiddleOfChain, relationshipStore.NewRecord(), NORMAL));

            // then
            assertEquals(DEGREE_TWO_NODES * 2, records.Size());
        }
Beispiel #20
0
        public IHttpActionResult CreateRecordStore(RecordStore recordStore)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            // add the RecordStore
            _ctx.RecordStores.Add(recordStore);
            _ctx.SaveChanges();

            return(Created(recordStore));
        }
        private static void BreakTheChain(RecordStore <RelationshipRecord> relationshipStore)
        {
            RelationshipRecord record          = relationshipStore.GetRecord(10, relationshipStore.NewRecord(), NORMAL);
            long relationshipTowardsEndOfChain = record.FirstNode;

            while (record.InUse() && !record.FirstInFirstChain)
            {
                record = relationshipStore.GetRecord(relationshipTowardsEndOfChain, relationshipStore.NewRecord(), FORCE);
                relationshipTowardsEndOfChain = record.FirstPrevRel;
            }

            relationshipStore.UpdateRecord(new RelationshipRecord(relationshipTowardsEndOfChain, 0, 0, 0));
        }
Beispiel #22
0
 protected internal override void CheckRelationship(RecordStore <RelationshipRecord> store, RelationshipRecord rel, RecordCheck <RelationshipRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport> checker)
 {
     if (_stage != null && (_stage == CheckStage.Stage6RSForward || _stage == CheckStage.Stage7RSBackward))
     {
         long id = rel.Id;
         Org.Neo4j.Consistency.checking.cache.CacheAccess_Client client = CacheAccess.client();
         CountLinks(id, rel.FirstNextRel, client);
         CountLinks(id, rel.FirstPrevRel, client);
         CountLinks(id, rel.SecondNextRel, client);
         CountLinks(id, rel.SecondPrevRel, client);
     }
     _report.forRelationship(rel, checker);
 }
        public DirectRecordAccessSet(RecordStore <NodeRecord> nodeStore, PropertyStore propertyStore, RecordStore <RelationshipRecord> relationshipStore, RecordStore <RelationshipGroupRecord> relationshipGroupStore, RecordStore <PropertyKeyTokenRecord> propertyKeyTokenStore, RecordStore <RelationshipTypeTokenRecord> relationshipTypeTokenStore, RecordStore <LabelTokenRecord> labelTokenStore, SchemaStore schemaStore)
        {
            Loaders loaders = new Loaders(nodeStore, propertyStore, relationshipStore, relationshipGroupStore, propertyKeyTokenStore, relationshipTypeTokenStore, labelTokenStore, schemaStore);

            _nodeRecords                  = new DirectRecordAccess <NodeRecord, Void>(nodeStore, loaders.NodeLoader());
            _propertyRecords              = new DirectRecordAccess <PropertyRecord, PrimitiveRecord>(propertyStore, loaders.PropertyLoader());
            _relationshipRecords          = new DirectRecordAccess <RelationshipRecord, Void>(relationshipStore, loaders.RelationshipLoader());
            _relationshipGroupRecords     = new DirectRecordAccess <RelationshipGroupRecord, int>(relationshipGroupStore, loaders.RelationshipGroupLoader());
            _propertyKeyTokenRecords      = new DirectRecordAccess <PropertyKeyTokenRecord, Void>(propertyKeyTokenStore, loaders.PropertyKeyTokenLoader());
            _relationshipTypeTokenRecords = new DirectRecordAccess <RelationshipTypeTokenRecord, Void>(relationshipTypeTokenStore, loaders.RelationshipTypeTokenLoader());
            _labelTokenRecords            = new DirectRecordAccess <LabelTokenRecord, Void>(labelTokenStore, loaders.LabelTokenLoader());
            _all = new DirectRecordAccess[] { _nodeRecords, _propertyRecords, _relationshipRecords, _relationshipGroupRecords, _propertyKeyTokenRecords, _relationshipTypeTokenRecords, _labelTokenRecords };
        }
Beispiel #24
0
        public static void RemoveRecord(string resName, int recordId)
        {
            RecordStore rs = null;

            try
            {
                rs = RecordStore.OpenRecordStore(resName, false);
                rs.DeleteRecord(recordId);
            }
            finally
            {
                CloseRecordStore(rs);
            }
        }
        private void Track <T1>(RecordStore <T1> store, AbstractBaseRecord record)
        {
            long   id     = max(record.Id, record.RequiresSecondaryUnit() ? record.SecondaryUnitId : -1);
            HighId highId = _highIds[store];

            if (highId == null)
            {
                _highIds[store] = new HighId(id);
            }
            else
            {
                highId.Track(id);
            }
        }
Beispiel #26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public IndexAccessors(org.neo4j.kernel.impl.api.index.IndexProviderMap providers, org.neo4j.kernel.impl.store.RecordStore<org.neo4j.kernel.impl.store.record.DynamicRecord> schemaStore, org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig samplingConfig) throws java.io.IOException
        public IndexAccessors(IndexProviderMap providers, RecordStore <DynamicRecord> schemaStore, IndexSamplingConfig samplingConfig)
        {
            IEnumerator <StoreIndexDescriptor> indexes = (new SchemaStorage(schemaStore)).indexesGetAll();

            for ( ; ;)
            {
                try
                {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    if (indexes.hasNext())
                    {
                        // we intentionally only check indexes that are online since
                        // - populating indexes will be rebuilt on next startup
                        // - failed indexes have to be dropped by the user anyways
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                        StoreIndexDescriptor indexDescriptor = indexes.next();
                        if (indexDescriptor.IndexWithoutOwningConstraint)
                        {
                            _notOnlineIndexRules.Add(indexDescriptor);
                        }
                        else
                        {
                            if (InternalIndexState.ONLINE == Provider(providers, indexDescriptor).getInitialState(indexDescriptor))
                            {
                                _onlineIndexRules.Add(indexDescriptor);
                            }
                            else
                            {
                                _notOnlineIndexRules.Add(indexDescriptor);
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                catch (Exception)
                {
                    // ignore; inconsistencies of the schema store are specifically handled elsewhere.
                }
            }

            foreach (StoreIndexDescriptor indexRule in _onlineIndexRules)
            {
                long indexId = indexRule.Id;
                _accessors.put(indexId, Provider(providers, indexRule).getOnlineAccessor(indexRule, samplingConfig));
            }
        }
        /// <summary>
        /// Starts replay of this result.
        /// </summary>
        public void Replay()
        {
            var replayFile = RecordStore.GetReplayFile(record.Value);

            if (replayFile != null && replayFile.Exists)
            {
                ScreenNavigator.Hide <ResultScreen>();
                OverlayNavigator.Show <GameLoadOverlay>().Model.StartLoad(new GameParameter()
                {
                    Map        = Map.Value,
                    ReplayFile = replayFile,
                    Record     = record.Value,
                });
            }
        }
Beispiel #28
0
            public override void Run(StoreAccess store, PrintStream @out)
            {
                long propId = FirstPropId(store);
                RecordStore <PropertyRecord> propertyStore = store.PropertyStore;
                PropertyRecord record = propertyStore.NewRecord();

                while (propId != Record.NO_NEXT_PROPERTY.intValue())
                {
                    propertyStore.GetRecord(propId, record, NORMAL);
                    // We rely on this method having the side-effect of loading the property blocks:
                    record.NumberOfProperties();
                    @out.println(record);
                    propId = record.NextProp;
                }
            }
Beispiel #29
0
        private void Defrag(int nodeCount, RecordStore <RelationshipGroupRecord> groupStore)
        {
            Monitor monitor = mock(typeof(Monitor));
            RelationshipGroupDefragmenter defragmenter = new RelationshipGroupDefragmenter(_config, ExecutionMonitors.invisible(), monitor, AUTO_WITHOUT_PAGECACHE);

            // Calculation below correlates somewhat to calculation in RelationshipGroupDefragmenter.
            // Anyway we verify below that we exercise the multi-pass bit, which is what we want
            long memory = groupStore.HighId * 15 + 200;

            defragmenter.Run(memory, _stores, nodeCount);

            // Verify that we exercise the multi-pass functionality
            verify(monitor, atLeast(2)).defragmentingNodeRange(anyLong(), anyLong());
            verify(monitor, atMost(10)).defragmentingNodeRange(anyLong(), anyLong());
        }
        private void CreateRecordIn <RECORD>(RecordStore <RECORD> store) where RECORD : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord
        {
            RECORD record = store.NewRecord();

            record.Id    = store.nextId();
            record.InUse = true;
            if (record is PropertyRecord)
            {
                // Special hack for property store, since it's not enough to simply set a record as in use there
                PropertyBlock block = new PropertyBlock();
                (( PropertyStore )store).encodeValue(block, 0, Values.of(10));
                (( PropertyRecord )record).addPropertyBlock(block);
            }
            store.UpdateRecord(record);
        }
Beispiel #31
0
    internal static RecordStore openRecordStore(string store, bool createIfNecessary)
    {
        RecordStore ret;

            var storage = IsolatedStorageFile.GetUserStoreForApplication();
            if (storage.FileExists(store))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(RecordStore));
                Stream stream = storage.OpenFile(store, FileMode.Open);
                ret = (RecordStore)serializer.Deserialize(stream);
                stream.Close();
                ret.name = store;
            }
            else
            {
                ret = new RecordStore();
                ret.name = store;
                ret.records.Add(null); // add dummy record because record id starts from 1
            }

            return ret;
    }