jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1444675 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment: CacheStore.java MemoryStore.java SegmentStore.java
Date Mon, 11 Feb 2013 08:07:50 GMT
Author: jukka
Date: Mon Feb 11 08:07:50 2013
New Revision: 1444675

URL: http://svn.apache.org/r1444675
Log:
OAK-593: Segment-based MK

Add basic journal functionality

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/CacheStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MemoryStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStore.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/CacheStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/CacheStore.java?rev=1444675&r1=1444674&r2=1444675&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/CacheStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/CacheStore.java
Mon Feb 11 08:07:50 2013
@@ -43,6 +43,16 @@ public class CacheStore implements Segme
     }
 
     @Override
+    public RecordId getJournalHead() {
+        return store.getJournalHead();
+    }
+
+    @Override
+    public boolean setJournalHead(RecordId head, RecordId base) {
+        return store.setJournalHead(head, base);
+    }
+
+    @Override
     public int getMaxSegmentSize() {
         return store.getMaxSegmentSize();
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MemoryStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MemoryStore.java?rev=1444675&r1=1444674&r2=1444675&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MemoryStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MemoryStore.java
Mon Feb 11 08:07:50 2013
@@ -21,6 +21,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
+import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeState;
+
 public class MemoryStore implements SegmentStore {
 
     private static final int MAX_SEGMENT_SIZE = 1 << 20; // 1MB
@@ -28,6 +30,29 @@ public class MemoryStore implements Segm
     private final Map<UUID, Segment> segments =
         Collections.synchronizedMap(new HashMap<UUID, Segment>());
 
+    private RecordId head;
+
+    public MemoryStore() {
+        SegmentWriter writer = new SegmentWriter(this);
+        this.head = writer.writeNode(MemoryNodeState.EMPTY_NODE);
+        writer.flush();
+    }
+
+    @Override
+    public synchronized RecordId getJournalHead() {
+        return head;
+    }
+
+    @Override
+    public synchronized boolean setJournalHead(RecordId head, RecordId base) {
+        if (this.head.equals(base)) {
+            this.head = head;
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     @Override
     public int getMaxSegmentSize() {
         return MAX_SEGMENT_SIZE;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStore.java?rev=1444675&r1=1444674&r2=1444675&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentStore.java
Mon Feb 11 08:07:50 2013
@@ -20,6 +20,10 @@ import java.util.UUID;
 
 public interface SegmentStore {
 
+    RecordId getJournalHead();
+
+    boolean setJournalHead(RecordId head, RecordId base);
+
     int getMaxSegmentSize();
 
     Segment readSegment(UUID segmentId);



Mime
View raw message