private static ByteBuffer ReadDynamic(AbstractDynamicStore store, long reference, ByteBuffer buffer, PageCursor page) { if (buffer == null) { buffer = ByteBuffer.allocate(512); } else { buffer.clear(); } DynamicRecord record = store.NewRecord(); do { //We need to load forcefully here since otherwise we can have inconsistent reads //for properties across blocks, see org.neo4j.graphdb.ConsistentPropertyReadsIT store.GetRecordByCursor(reference, record, RecordLoad.FORCE, page); reference = record.NextBlock; sbyte[] data = record.Data; if (buffer.remaining() < data.Length) { buffer = Grow(buffer, data.Length); } buffer.put(data, 0, data.Length); } while (reference != NO_ID); return(buffer); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void dynamicRecordCursorReadsInUseRecords() public virtual void DynamicRecordCursorReadsInUseRecords() { using (AbstractDynamicStore store = NewTestableDynamicStore()) { DynamicRecord first = CreateDynamicRecord(1, store, 0); DynamicRecord second = CreateDynamicRecord(2, store, 0); DynamicRecord third = CreateDynamicRecord(3, store, 10); store.HighId = 3; first.NextBlock = second.Id; store.UpdateRecord(first); second.NextBlock = third.Id; store.UpdateRecord(second); IEnumerator <DynamicRecord> records = store.GetRecords(1, NORMAL).GetEnumerator(); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(records.hasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(first, records.next()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(records.hasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(second, records.next()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(records.hasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(third, records.next()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(records.hasNext()); } }
private DynamicRecord CreateDynamicRecord(long id, AbstractDynamicStore store, int dataSize) { DynamicRecord first = new DynamicRecord(id); first.InUse = true; first.Data = RandomUtils.NextBytes(dataSize == 0 ? BLOCK_SIZE - _formats.dynamic().RecordHeaderSize : 10); store.UpdateRecord(first); return(first); }
private static void AllocateStringRecords(ICollection <DynamicRecord> target, sbyte[] chars, DynamicRecordAllocator allocator) { AbstractDynamicStore.AllocateRecordsFromBytes(target, chars, allocator); }
public static Pair <long, long[]> GetDynamicLabelsArrayAndOwner(IEnumerable <DynamicRecord> records, AbstractDynamicStore dynamicLabelStore) { long[] storedLongs = ( long[] )DynamicArrayStore.GetRightArray(dynamicLabelStore.ReadFullByteArray(records, PropertyType.Array)).asObject(); return(Pair.of(storedLongs[0], LabelIdArray.StripNodeId(storedLongs))); }
public static ICollection <DynamicRecord> AllocateRecordsForDynamicLabels(long nodeId, long[] labels, AbstractDynamicStore dynamicLabelStore) { return(AllocateRecordsForDynamicLabels(nodeId, labels, ( DynamicRecordAllocator )dynamicLabelStore)); }