public override void Run(StoreAccess store, PrintStream @out) { RecordStore <NodeRecord> nodeStore = store.NodeStore; NodeRecord node = nodeStore.GetRecord(Id, nodeStore.NewRecord(), NORMAL); if (node.Dense) { RecordStore <RelationshipGroupRecord> relationshipGroupStore = store.RelationshipGroupStore; RelationshipGroupRecord group = relationshipGroupStore.NewRecord(); relationshipGroupStore.GetRecord(node.NextRel, group, NORMAL); do { @out.println("group " + group); @out.println("out:"); PrintRelChain(store, @out, group.FirstOut); @out.println("in:"); PrintRelChain(store, @out, group.FirstIn); @out.println("loop:"); PrintRelChain(store, @out, group.FirstLoop); group = group.Next != -1 ? relationshipGroupStore.GetRecord(group.Next, group, NORMAL) : null; } while (group != null); } else { PrintRelChain(store, @out, node.NextRel); } }
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)); }
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); }
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; } }
internal virtual void PrintRelChain(StoreAccess access, PrintStream @out, long firstRelId) { for (long rel = firstRelId; rel != Record.NO_NEXT_RELATIONSHIP.intValue();) { RecordStore <RelationshipRecord> relationshipStore = access.RelationshipStore; RelationshipRecord record = relationshipStore.GetRecord(rel, relationshipStore.NewRecord(), NORMAL); @out.println(rel + "\t" + record); if (record.FirstNode == Id) { rel = record.FirstNextRel; } else { rel = record.SecondNextRel; } } }
protected internal override void ProcessCache() { RecordStore <NodeRecord> nodeStore = StoreAccess.NodeStore; CacheAccess_Client client = CacheAccess.client(); long highId = nodeStore.HighId; for (long nodeId = 0; nodeId < highId; nodeId++) { if (client.GetFromCache(nodeId, CacheSlots_NextRelationship_Fields.SLOT_FIRST_IN_TARGET) == 0) { NodeRecord node = nodeStore.GetRecord(nodeId, nodeStore.NewRecord(), FORCE); if (node.InUse() && !node.Dense) { StoreProcessor.processNode(nodeStore, node); } } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void dump(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException internal virtual void Dump(DatabaseLayout databaseLayout) { using (DefaultFileSystemAbstraction fs = new DefaultFileSystemAbstraction(), PageCache pageCache = createPageCache(fs, createInitialisedScheduler())) { DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs); Config config = Config.defaults(); StoreFactory storeFactory = new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, fs, LogProvider(), EmptyVersionContextSupplier.EMPTY); using (NeoStores neoStores = storeFactory.OpenNeoStores(StoreTypes)) { RecordStore <RECORD> store = store(neoStores); RECORD record = store.NewRecord(); for (long next = FirstRecord; next != -1;) { store.GetRecord(next, record, RecordLoad.FORCE); Console.WriteLine(record); next = next(record); } } } }
public static byte[] GetBytes(string resName, int recordId) { byte[] result = new byte[0]; RecordStore rs = null; try { rs = RecordStore.OpenRecordStore(resName, true); if (rs.Count >= recordId) { result = rs.GetRecord(recordId); } } catch (Exception ex) { Log.Exception(ex.Message); } finally { CloseRecordStore(rs); } return(result); }
//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()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCopeWithAChainThatReferencesNotInUseZeroValueRecords() public virtual void ShouldCopeWithAChainThatReferencesNotInUseZeroValueRecords() { // given RecordStore <RelationshipRecord> relationshipStore = _store.RelationshipStore; BreakTheChain(relationshipStore); // when int relationshipIdInMiddleOfChain = 10; RecordSet <RelationshipRecord> records = (new RelationshipChainExplorer(relationshipStore)).ExploreRelationshipRecordChainsToDepthTwo(relationshipStore.GetRecord(relationshipIdInMiddleOfChain, relationshipStore.NewRecord(), NORMAL)); // then int recordsInaccessibleBecauseOfBrokenChain = 3; assertEquals(DEGREE_TWO_NODES * 2 - recordsInaccessibleBecauseOfBrokenChain, records.Size()); }
protected internal override long FirstPropId(StoreAccess access) { RecordStore <RelationshipRecord> relationshipStore = access.RelationshipStore; return(relationshipStore.GetRecord(Id, relationshipStore.NewRecord(), NORMAL).NextProp); }
protected internal override long FirstPropId(StoreAccess access) { RecordStore <NodeRecord> nodeStore = access.NodeStore; return(nodeStore.GetRecord(Id, nodeStore.NewRecord(), NORMAL).NextProp); }
internal virtual DirectRecordReference <RECORD> ReferenceTo <RECORD>(RecordStore <RECORD> store, long id) where RECORD : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord { return(new DirectRecordReference <RECORD>(store.GetRecord(id, store.NewRecord(), FORCE), this)); }
protected internal virtual R GetRecord <R>(RecordStore <R> store, long id, R into) where R : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord { store.GetRecord(id, into, RecordLoad.FORCE); return(into); }
private static ISet <long> LabelsFor <T1>(RecordStore <NodeRecord> nodeStore, CheckerEngine <T1> engine, RecordAccess recordAccess, long nodeId) where T1 : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord { return(getListOfLabels(nodeStore.GetRecord(nodeId, nodeStore.NewRecord(), FORCE), recordAccess, engine)); }