jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1547244 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: kernel/ plugins/memory/ plugins/segment/ spi/state/
Date Tue, 03 Dec 2013 00:10:33 GMT
Author: jukka
Date: Tue Dec  3 00:10:32 2013
New Revision: 1547244

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

No more need for copy() and move() to be on NodeStoreBranch, so push them
down to AbstractNodeStoreBranch for use by backends that still need them.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeStoreBranch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java?rev=1547244&r1=1547243&r2=1547244&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
Tue Dec  3 00:10:32 2013
@@ -48,7 +48,6 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
 
 /**
  * {@code NodeStore} implementations against {@link MicroKernel}.
@@ -233,7 +232,7 @@ public class KernelNodeStore implements 
         }
     }
 
-    NodeStoreBranch createBranch(KernelNodeState base) {
+    KernelNodeStoreBranch createBranch(KernelNodeState base) {
         return new KernelNodeStoreBranch(this, changeDispatcher, mergeLock, base);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java?rev=1547244&r1=1547243&r2=1547244&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRootBuilder.java
Tue Dec  3 00:10:32 2013
@@ -25,7 +25,6 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStoreBranch;
 
 /**
  * This implementation tracks the number of pending changes and purges them to
@@ -56,7 +55,7 @@ class KernelRootBuilder extends MemoryNo
     /**
      * Private branch used to hold pending changes exceeding {@link #UPDATE_LIMIT}
      */
-    private NodeStoreBranch branch;
+    private KernelNodeStoreBranch branch;
 
     /**
      * Number of updated not yet persisted to the private {@link #branch}

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java?rev=1547244&r1=1547243&r2=1547244&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeStore.java
Tue Dec  3 00:10:32 2013
@@ -212,16 +212,6 @@ public class MemoryNodeStore implements 
         }
 
         @Override
-        public boolean copy(String source, String target) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public boolean move(String source, String target) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
         public void rebase() {
             throw new UnsupportedOperationException();
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java?rev=1547244&r1=1547243&r2=1547244&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreBranch.java
Tue Dec  3 00:10:32 2013
@@ -28,7 +28,6 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.state.ConflictAnnotatingRebaseDiff;
@@ -210,91 +209,6 @@ class SegmentNodeStoreBranch implements 
     }
 
     @Override
-    public boolean move(String source, String target) {
-        if (PathUtils.isAncestor(source, target)) {
-            return false;
-        } else if (source.equals(target)) {
-            return true;
-        }
-
-        NodeBuilder builder = getHead().builder();
-
-        NodeBuilder targetBuilder = builder;
-        String targetParent = PathUtils.getParentPath(target);
-        for (String name : PathUtils.elements(targetParent)) {
-            if (targetBuilder.hasChildNode(name)) {
-                targetBuilder = targetBuilder.child(name);
-            } else {
-                return false;
-            }
-        }
-        String targetName = PathUtils.getName(target);
-        if (targetBuilder.hasChildNode(targetName)) {
-            return false;
-        }
-
-        NodeBuilder sourceBuilder = builder;
-        String sourceParent = PathUtils.getParentPath(source);
-        for (String name : PathUtils.elements(sourceParent)) {
-            if (sourceBuilder.hasChildNode(name)) {
-                sourceBuilder = sourceBuilder.child(name);
-            } else {
-                return false;
-            }
-        }
-        String sourceName = PathUtils.getName(source);
-        if (!sourceBuilder.hasChildNode(sourceName)) {
-            return false;
-        }
-
-        NodeState sourceState = sourceBuilder.child(sourceName).getNodeState();
-        targetBuilder.setChildNode(targetName, sourceState);
-        sourceBuilder.getChildNode(sourceName).remove();
-
-        setRoot(builder.getNodeState());
-        return true;
-    }
-
-    @Override
-    public boolean copy(String source, String target) {
-        NodeBuilder builder = getHead().builder();
-
-        NodeBuilder targetBuilder = builder;
-        String targetParent = PathUtils.getParentPath(target);
-        for (String name : PathUtils.elements(targetParent)) {
-            if (targetBuilder.hasChildNode(name)) {
-                targetBuilder = targetBuilder.child(name);
-            } else {
-                return false;
-            }
-        }
-        String targetName = PathUtils.getName(target);
-        if (targetBuilder.hasChildNode(targetName)) {
-            return false;
-        }
-
-        NodeBuilder sourceBuilder = builder;
-        String sourceParent = PathUtils.getParentPath(source);
-        for (String name : PathUtils.elements(sourceParent)) {
-            if (sourceBuilder.hasChildNode(name)) {
-                sourceBuilder = sourceBuilder.child(name);
-            } else {
-                return false;
-            }
-        }
-        String sourceName = PathUtils.getName(source);
-        if (!sourceBuilder.hasChildNode(sourceName)) {
-            return false;
-        }
-
-        NodeState sourceState = sourceBuilder.child(sourceName).getNodeState();
-        targetBuilder.setChildNode(targetName, sourceState);
-
-        setRoot(builder.getNodeState());
-        return true;
-    }
-
-    @Override
     public String toString() {
         return getHead().toString();
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeStoreBranch.java?rev=1547244&r1=1547243&r2=1547244&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeStoreBranch.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/AbstractNodeStoreBranch.java
Tue Dec  3 00:10:32 2013
@@ -199,7 +199,14 @@ public abstract class AbstractNodeStoreB
         branchState.setRoot(checkNotNull(newRoot));
     }
 
-    @Override
+    /**
+     * Moves a node in this private branch.
+     *
+     * @param source source path
+     * @param target target path
+     * @return  {@code true} iff the move succeeded
+     * @throws IllegalStateException if the branch is already merged
+     */
     public boolean move(String source, String target) {
         if (PathUtils.isAncestor(checkNotNull(source), checkNotNull(target))) {
             return false;
@@ -224,7 +231,14 @@ public abstract class AbstractNodeStoreB
         return true;
     }
 
-    @Override
+    /**
+     * Copies a node in this private branch.
+     *
+     * @param source source path
+     * @param target target path
+     * @return  {@code true} iff the copy succeeded
+     * @throws IllegalStateException if the branch is already merged
+     */
     public boolean copy(String source, String target) {
         if (!getNode(checkNotNull(source)).exists()) {
             // source does not exist

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java?rev=1547244&r1=1547243&r2=1547244&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/state/NodeStoreBranch.java
Tue Dec  3 00:10:32 2013
@@ -62,26 +62,6 @@ public interface NodeStoreBranch {
     void setRoot(NodeState newRoot);
 
     /**
-     * Moves a node in this private branch.
-     *
-     * @param source source path
-     * @param target target path
-     * @return  {@code true} iff the move succeeded
-     * @throws IllegalStateException if the branch is already merged
-     */
-    boolean move(String source, String target);
-
-    /**
-     * Copies a node in this private branch.
-     *
-     * @param source source path
-     * @param target target path
-     * @return  {@code true} iff the copy succeeded
-     * @throws IllegalStateException if the branch is already merged
-     */
-    boolean copy(String source, String target);
-
-    /**
      * Merges the changes in this branch to the main content tree.
      * Merging is done by rebasing the changes in this branch on top of
      * the current head revision followed by a fast forward merge.



Mime
View raw message