jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1514217 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins: memory/MemoryNodeBuilder.java segment/SegmentNodeBuilder.java segment/SegmentNodeState.java segment/SegmentRootBuilder.java
Date Thu, 15 Aug 2013 09:22:56 GMT
Author: jukka
Date: Thu Aug 15 09:22:56 2013
New Revision: 1514217

URL: http://svn.apache.org/r1514217
Log:
OAK-659: Move purge logic for transient changes below the NodeBuilder interface

Revert previous commit until the test failure is sorted out.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentRootBuilder.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1514217&r1=1514216&r2=1514217&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Thu Aug 15 09:22:56 2013
@@ -79,18 +79,18 @@ public class MemoryNodeBuilder implement
     /**
      * Parent builder, or {@code null} for a root builder.
      */
-    protected final MemoryNodeBuilder parent;
+    private final MemoryNodeBuilder parent;
 
     /**
      * Name of this child node within the parent builder,
      * or {@code null} for a root builder.
      */
-    protected final String name;
+    private final String name;
 
     /**
      * Root builder, or {@code this} for the root builder itself.
      */
-    protected final MemoryNodeBuilder rootBuilder;
+    private final MemoryNodeBuilder rootBuilder;
 
     /**
      * Internal revision counter for the base state of this builder. The counter

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeBuilder.java?rev=1514217&r1=1514216&r2=1514217&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeBuilder.java
Thu Aug 15 09:22:56 2013
@@ -17,24 +17,15 @@
 package org.apache.jackrabbit.oak.plugins.segment;
 
 import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 class SegmentNodeBuilder extends MemoryNodeBuilder {
 
-    protected NodeState base;
-
-    protected long baseRevision;
-
     protected SegmentNodeBuilder(SegmentNodeState base) {
         super(base);
-        this.base = base;
-        this.baseRevision = 0;
     }
 
     private SegmentNodeBuilder(SegmentNodeBuilder parent, String name) {
         super(parent, name);
-        this.base = parent.base.getChildNode(name);
-        this.baseRevision = parent.baseRevision;
     }
 
     @Override
@@ -42,15 +33,4 @@ class SegmentNodeBuilder extends MemoryN
         return new SegmentNodeBuilder(this, name);
     }
 
-    @Override
-    public NodeState getBaseState() {
-        // TODO: Use the head mechanism in MemoryNodeBuilder instead of
-        // overriding base state tracking
-        if (baseRevision != ((SegmentNodeBuilder) rootBuilder).baseRevision) {
-            base = parent.getBaseState().getChildNode(name);
-            baseRevision = ((SegmentNodeBuilder) rootBuilder).baseRevision;
-        }
-        return base;
-    }
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java?rev=1514217&r1=1514216&r2=1514217&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
Thu Aug 15 09:22:56 2013
@@ -131,7 +131,7 @@ public class SegmentNodeState extends Ab
 
     @Override @Nonnull
     public NodeBuilder builder() {
-        return new SegmentRootBuilder(this, new SegmentWriter(store));
+        return new SegmentRootBuilder(this);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentRootBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentRootBuilder.java?rev=1514217&r1=1514216&r2=1514217&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentRootBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentRootBuilder.java
Thu Aug 15 09:22:56 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.segment;
 
-import org.apache.jackrabbit.oak.spi.state.NodeState;
-
 class SegmentRootBuilder extends SegmentNodeBuilder {
 
     /**
@@ -27,38 +25,19 @@ class SegmentRootBuilder extends Segment
     private static final int UPDATE_LIMIT =
             Integer.getInteger("update.limit", 1000);
 
-    private final SegmentWriter writer;
-
     private long updateCount = 0;
 
-    SegmentRootBuilder(SegmentNodeState base, SegmentWriter writer) {
+    SegmentRootBuilder(SegmentNodeState base) {
         super(base);
-        this.writer = writer;
     }
 
     @Override
     protected void updated() {
         updateCount++;
         if (updateCount > UPDATE_LIMIT) {
-            getNodeState(); // flush changes
+            // TODO: flush
             updateCount = 0;
         }
     }
 
-    // TODO: Allow flushing of also non-root builders
-    @Override
-    public SegmentNodeState getNodeState() {
-        SegmentNodeState state = writer.writeNode(super.getNodeState());
-        writer.flush();
-        super.reset(state);
-        return state;
-    }
-
-    @Override
-    public void reset(NodeState newBase) {
-        base = newBase;
-        baseRevision++;
-        super.reset(newBase);
-    }
-
 }



Mime
View raw message