jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1443450 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment: ListRecord.java MapRecord.java Record.java
Date Thu, 07 Feb 2013 13:13:55 GMT
Author: jukka
Date: Thu Feb  7 13:13:55 2013
New Revision: 1443450

URL: http://svn.apache.org/viewvc?rev=1443450&view=rev
Log:
OAK-593: Segment-based MK

Call reader directly in record methods

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/ListRecord.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MapRecord.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/ListRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/ListRecord.java?rev=1443450&r1=1443449&r2=1443450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/ListRecord.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/ListRecord.java
Thu Feb  7 13:13:55 2013
@@ -51,7 +51,7 @@ class ListRecord extends Record {
         } else {
             int bucketIndex = index / bucketSize;
             int bucketOffset = index % bucketSize;
-            RecordId bucketId = readRecordId(reader, bucketIndex * 4);
+            RecordId bucketId = reader.readRecordId(getRecordId(), bucketIndex * 4);
             ListRecord bucket =
                 new ListRecord(bucketId, bucketSize);
             return bucket.getEntry(reader, bucketOffset);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MapRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MapRecord.java?rev=1443450&r1=1443449&r2=1443450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MapRecord.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MapRecord.java
Thu Feb  7 13:13:55 2013
@@ -27,7 +27,7 @@ class MapRecord extends Record {
     }
 
     public int size(SegmentReader reader) {
-        return readInt(reader, 0);
+        return reader.readInt(getRecordId(), 0);
     }
 
     public RecordId getEntry(SegmentReader reader, String key) {
@@ -41,29 +41,29 @@ class MapRecord extends Record {
         int shift = level * LEVEL_BITS;
 
         int code = key.hashCode();
-        int bucketSize = readInt(reader, 0);
+        int bucketSize = reader.readInt(getRecordId(), 0);
         if (bucketSize == 0) {
             return null;
         } else if (bucketSize <= size || shift >= 32) {
             int offset = 0;
-            while (offset < bucketSize && readInt(reader, 4 + offset * 4) <
code) {
+            while (offset < bucketSize && reader.readInt(getRecordId(), 4 + offset
* 4) < code) {
                 offset++;
             }
-            while (offset < bucketSize && readInt(reader, 4 + offset * 4) == code)
{
-                RecordId keyId = readRecordId(reader, 4 + (bucketSize + offset) * 4);
+            while (offset < bucketSize && reader.readInt(getRecordId(), 4 + offset
* 4) == code) {
+                RecordId keyId = reader.readRecordId(getRecordId(), 4 + (bucketSize + offset)
* 4);
                 if (key.equals(reader.readString(keyId))) {
-                    return readRecordId(reader, 4 + (2 * bucketSize + offset) * 4);
+                    return reader.readRecordId(getRecordId(), 4 + (2 * bucketSize + offset)
* 4);
                 }
                 offset++;
             }
             return null;
         } else {
-            long bucketMap = readLong(reader, 4);
+            long bucketMap = reader.readLong(getRecordId(), 4);
             int bucketIndex = (code >> shift) & mask;
             long bucketBit = 1L << bucketIndex;
             if ((bucketMap & bucketBit) != 0) {
                 bucketIndex = Long.bitCount(bucketMap & (bucketBit - 1));
-                RecordId bucketId = readRecordId(reader, 12 + bucketIndex * 4);
+                RecordId bucketId = reader.readRecordId(getRecordId(), 12 + bucketIndex *
4);
                 return new MapRecord(bucketId).getEntry(reader, key, level + 1);
             } else {
                 return null;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java?rev=1443450&r1=1443449&r2=1443450&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Record.java
Thu Feb  7 13:13:55 2013
@@ -24,18 +24,6 @@ class Record {
         this.id = id;
     }
 
-    protected RecordId readRecordId(SegmentReader reader, int position) {
-        return reader.readRecordId(id, position);
-    }
-
-    protected int readInt(SegmentReader reader, int position) {
-        return reader.readInt(id, position);
-    }
-
-    protected long readLong(SegmentReader reader, int position) {
-        return reader.readLong(id, position);
-    }
-
     public RecordId getRecordId() {
         return id;
     }



Mime
View raw message