private ICollection <DynamicRecord> AllocateAndApply(NodeStore nodeStore, long nodeId, long[] longs) { ICollection <DynamicRecord> records = DynamicNodeLabels.allocateRecordsForDynamicLabels(nodeId, longs, nodeStore.DynamicLabelStore); nodeStore.UpdateDynamicLabelRecords(records); return(records); }
public static NodeCommand CreateNode(long id, params long[] dynamicLabelRecordIds) { NodeRecord record = new NodeRecord(id); record.InUse = true; record.SetCreated(); if (dynamicLabelRecordIds.Length > 0) { ICollection <DynamicRecord> dynamicRecords = dynamicRecords(dynamicLabelRecordIds); record.SetLabelField(DynamicNodeLabels.dynamicPointer(dynamicRecords), dynamicRecords); } return(new NodeCommand(new NodeRecord(id), record)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void oneDynamicRecordShouldStoreItsOwner() public virtual void OneDynamicRecordShouldStoreItsOwner() { // GIVEN // will occupy 60B of data, i.e. one dynamic record long? nodeId = 24L; NodeRecord node = nodeRecordWithDynamicLabels(nodeId, _nodeStore, OneByteLongs(56)); ICollection <DynamicRecord> initialRecords = node.DynamicLabelRecords; // WHEN Pair <long, long[]> pair = DynamicNodeLabels.getDynamicLabelsArrayAndOwner(initialRecords, _nodeStore.DynamicLabelStore); // THEN assertEquals(nodeId, pair.First()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void twoDynamicRecordsShouldShrinkToOneWhenRemovingWithoutChangingItsOwner() public virtual void TwoDynamicRecordsShouldShrinkToOneWhenRemovingWithoutChangingItsOwner() { // GIVEN // will occupy 61B of data, i.e. just two dynamic records long? nodeId = 42L; NodeRecord node = nodeRecordWithDynamicLabels(nodeId, _nodeStore, OneByteLongs(57)); NodeLabels nodeLabels = NodeLabelsField.parseLabelsField(node); IList <DynamicRecord> changedDynamicRecords = Iterables.addToCollection(nodeLabels.Remove(255, _nodeStore), new List <DynamicRecord>()); // WHEN Pair <long, long[]> changedPair = DynamicNodeLabels.getDynamicLabelsArrayAndOwner(changedDynamicRecords, _nodeStore.DynamicLabelStore); // THEN assertEquals(nodeId, changedPair.First()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSpillOverToDynamicRecordIfExceedsInlinedSpace() public virtual void ShouldSpillOverToDynamicRecordIfExceedsInlinedSpace() { // GIVEN -- the upper limit for a label ID for 3 labels would be 36b/3 - 1 = 12b - 1 = 4095 long labelId1 = 10; long labelId2 = 30; long labelId3 = 4096; NodeRecord node = NodeRecordWithInlinedLabels(labelId1, labelId2); NodeLabels nodeLabels = NodeLabelsField.parseLabelsField(node); // WHEN ICollection <DynamicRecord> changedDynamicRecords = nodeLabels.Add(labelId3, _nodeStore, _nodeStore.DynamicLabelStore); // THEN assertEquals(1, Iterables.count(changedDynamicRecords)); assertEquals(DynamicLabelsLongRepresentation(changedDynamicRecords), node.LabelField); assertTrue(Arrays.Equals(new long[] { labelId1, labelId2, labelId3 }, DynamicNodeLabels.getDynamicLabelsArray(changedDynamicRecords, _nodeStore.DynamicLabelStore))); }