jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1525683 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment: SegmentNodeState.java SegmentRootBuilder.java
Date Mon, 23 Sep 2013 20:23:06 GMT
Author: jukka
Date: Mon Sep 23 20:23:06 2013
New Revision: 1525683

URL: http://svn.apache.org/r1525683
Log:
OAK-1036: SegmentMK: Auto-flushing SegmentNodeBuilder

Add auto-flushing to SegmentRootBuilder.

Modified:
    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/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=1525683&r1=1525682&r2=1525683&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
Mon Sep 23 20:23:06 2013
@@ -131,7 +131,7 @@ public class SegmentNodeState extends Ab
 
     @Override @Nonnull
     public NodeBuilder builder() {
-        return new SegmentRootBuilder(this);
+        return new SegmentRootBuilder(this, store);
     }
 
     @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=1525683&r1=1525682&r2=1525683&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
Mon Sep 23 20:23:06 2013
@@ -25,19 +25,30 @@ 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) {
+    SegmentRootBuilder(SegmentNodeState base, SegmentStore store) {
         super(base);
+        this.writer = new SegmentWriter(store);
     }
 
     @Override
     protected void updated() {
         updateCount++;
         if (updateCount > UPDATE_LIMIT) {
-            // TODO: flush
-            updateCount = 0;
+            getNodeState();
         }
     }
 
+    @Override
+    public SegmentNodeState getNodeState() {
+        SegmentNodeState state = writer.writeNode(super.getNodeState());
+        writer.flush();
+        set(state);
+        updateCount = 0;
+        return state;
+    }
+
 }



Mime
View raw message