Author: mduerig
Date: Tue Apr 26 14:04:41 2016
New Revision: 1741031

URL: http://svn.apache.org/viewvc?rev=1741031&view=rev
Log:
OAK-4290: Update segment parser to work with the new segment format
Make the stable id part of the NodeInfo

Modified:
    
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/segment/SegmentParser.java
    
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/segment/SegmentParser.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/segment/SegmentParser.java?rev=1741031&r1=1741030&r2=1741031&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/segment/SegmentParser.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/main/java/org/apache/jackrabbit/oak/segment/SegmentParser.java
 Tue Apr 26 14:04:41 2016
@@ -84,6 +84,9 @@ public class SegmentParser {
         /** Id of this record*/
         public final RecordId nodeId;
 
+        /** Stable id of this node */
+        public final String stableId;
+
         /** Number of child nodes */
         public final int nodeCount;
 
@@ -93,8 +96,9 @@ public class SegmentParser {
         /** Size in bytes of this node */
         public final int size;
 
-        public NodeInfo(RecordId nodeId, int nodeCount, int propertyCount, int 
size) {
+        public NodeInfo(RecordId nodeId, String stableId, int nodeCount, int 
propertyCount, int size) {
             this.nodeId = nodeId;
+            this.stableId = stableId;
             this.nodeCount = nodeCount;
             this.propertyCount = propertyCount;
             this.size = size;
@@ -409,9 +413,7 @@ public class SegmentParser {
 
         Segment segment = nodeId.getSegment();
         int offset = nodeId.getOffset();
-        // FIXME OAK-4290: Update segment parser to work with the new segment 
format
-        // Process the node id (a RecordId) if present calling the respective 
call back
-        //segment.readRecordId(offset);
+        String stableId = new SegmentNodeState(nodeId).getStableId();
         offset += RECORD_ID_BYTES;
         RecordId templateId = segment.readRecordId(offset);
         onTemplate(nodeId, templateId);
@@ -454,7 +456,7 @@ public class SegmentParser {
             }
             onList(nodeId, id, propertyTemplates.length);
         }
-        return new NodeInfo(nodeId, nodeCount, propertyCount, size);
+        return new NodeInfo(nodeId, stableId, nodeCount, propertyCount, size);
     }
 
     /**

Modified: 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java?rev=1741031&r1=1741030&r2=1741031&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-next/src/test/java/org/apache/jackrabbit/oak/segment/SegmentParserTest.java
 Tue Apr 26 14:04:41 2016
@@ -162,6 +162,7 @@ public class SegmentParserTest {
         assertEquals(0, info.nodeCount);
         assertEquals(0, info.propertyCount);
         assertEquals(3, info.size);
+        assertEquals(info.nodeId.toString10(), info.stableId);
     }
 
     @Test
@@ -177,6 +178,7 @@ public class SegmentParserTest {
         assertEquals(1, info.nodeCount);
         assertEquals(0, info.propertyCount);
         assertEquals(6, info.size);
+        assertEquals(info.nodeId.toString10(), info.stableId);
     }
 
     @Test
@@ -197,6 +199,7 @@ public class SegmentParserTest {
         assertEquals(2, info.nodeCount);
         assertEquals(1, info.propertyCount);
         assertEquals(9, info.size);
+        assertEquals(info.nodeId.toString10(), info.stableId);
     }
 
     @Test


Reply via email to