You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by to...@apache.org on 2018/03/20 10:53:45 UTC
svn commit: r1827291 [2/2] - in /jackrabbit/oak/trunk: oak-parent/
oak-run/src/main/java/org/apache/jackrabbit/oak/explorer/ oak-segment-tar/
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/
oak-segment-tar/src/main/java/org/apache/jack...
Copied: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/FileStoreMonitor.java (from r1827287, jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/FileStoreMonitor.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/FileStoreMonitor.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/FileStoreMonitor.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/FileStoreMonitor.java&r1=1827287&r2=1827291&rev=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/FileStoreMonitor.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/FileStoreMonitor.java Tue Mar 20 10:53:44 2018
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.jackrabbit.oak.segment.file.tar;
+package org.apache.jackrabbit.oak.segment.spi.monitor;
/**
* FileStoreMonitor are notified for any writes or deletes
Copied: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/FileStoreMonitorAdapter.java (from r1827287, jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/FileStoreMonitorAdapter.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/FileStoreMonitorAdapter.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/FileStoreMonitorAdapter.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/FileStoreMonitorAdapter.java&r1=1827287&r2=1827291&rev=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/FileStoreMonitorAdapter.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/FileStoreMonitorAdapter.java Tue Mar 20 10:53:44 2018
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.jackrabbit.oak.segment.file.tar;
+package org.apache.jackrabbit.oak.segment.spi.monitor;
public class FileStoreMonitorAdapter implements FileStoreMonitor {
Copied: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/IOMonitor.java (from r1827287, jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/IOMonitor.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/IOMonitor.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/IOMonitor.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/IOMonitor.java&r1=1827287&r2=1827291&rev=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/IOMonitor.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/IOMonitor.java Tue Mar 20 10:53:44 2018
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.jackrabbit.oak.segment.file.tar;
+package org.apache.jackrabbit.oak.segment.spi.monitor;
import java.io.File;
Copied: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/IOMonitorAdapter.java (from r1827287, jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/IOMonitorAdapter.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/IOMonitorAdapter.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/IOMonitorAdapter.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/IOMonitorAdapter.java&r1=1827287&r2=1827291&rev=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/IOMonitorAdapter.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/monitor/IOMonitorAdapter.java Tue Mar 20 10:53:44 2018
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.jackrabbit.oak.segment.file.tar;
+package org.apache.jackrabbit.oak.segment.spi.monitor;
import java.io.File;
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/GCJournalFile.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/GCJournalFile.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/GCJournalFile.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/GCJournalFile.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,12 @@
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import java.io.IOException;
+import java.util.List;
+
+public interface GCJournalFile {
+
+ void writeLine(String line) throws IOException;
+
+ List<String> readLines() throws IOException;
+
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFile.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFile.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFile.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFile.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,14 @@
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import java.io.IOException;
+
+public interface JournalFile {
+
+ JournalFileReader openJournalReader() throws IOException;
+
+ JournalFileWriter openJournalWriter() throws IOException;
+
+ String getName();
+
+ boolean exists();
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFileReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFileReader.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFileReader.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFileReader.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,10 @@
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+public interface JournalFileReader extends Closeable {
+
+ String readLine() throws IOException;
+
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFileWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFileWriter.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFileWriter.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/JournalFileWriter.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,12 @@
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+public interface JournalFileWriter extends Closeable {
+
+ void truncate() throws IOException;
+
+ void writeLine(String line) throws IOException;
+
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/ManifestFile.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/ManifestFile.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/ManifestFile.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/ManifestFile.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,14 @@
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import java.io.IOException;
+import java.util.Properties;
+
+public interface ManifestFile {
+
+ boolean exists();
+
+ Properties load() throws IOException;
+
+ void save(Properties properties) throws IOException;
+
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/RepositoryLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/RepositoryLock.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/RepositoryLock.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/RepositoryLock.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,9 @@
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import java.io.IOException;
+
+public interface RepositoryLock {
+
+ void unlock() throws IOException;
+
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveEntry.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveEntry.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveEntry.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+public interface SegmentArchiveEntry {
+
+ /**
+ * Return the most significant bits of the identifier of this entry.
+ *
+ * @return the most significant bits of the identifier of this entry.
+ */
+ long getMsb();
+
+ /**
+ * Return the least significant bits of the identifier of this entry.
+ *
+ * @return the least significant bits of the identifier of this entry.
+ */
+ long getLsb();
+
+ /**
+ * Return the length of this entry in the archive.
+ *
+ * @return the length of this entry in the archive.
+ */
+ int getLength();
+
+ /**
+ * Return the generation of this entry.
+ *
+ * @return the generation of this entry.
+ */
+ int getGeneration();
+
+ /**
+ * Return the full generation of this entry.
+ *
+ * @return the full generation of this entry.
+ */
+ int getFullGeneration();
+
+ /**
+ * Return {@code true} if this entry was generated by a compaction operation.
+ *
+ * @return {@code true} if this entry was generated by a compaction operation.
+ */
+ boolean isCompacted();
+
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveManager.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveManager.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveManager.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * SegmentArchiveManager provides a low-level access to the segment files (eg.
+ * stored in the .tar). It allows to perform a few FS-like operations (delete,
+ * rename, copy, etc.) and also opens the segment archives either for reading
+ * or reading and writing.
+ */
+public interface SegmentArchiveManager {
+
+ /**
+ * List names of the available archives.
+ *
+ * @return archive list
+ */
+ @Nonnull
+ List<String> listArchives() throws IOException;
+
+ /**
+ * Opens a given archive for reading.
+ *
+ * @param archiveName
+ * @return the archive reader or null if the archive doesn't exist
+ */
+ @Nullable
+ SegmentArchiveReader open(@Nonnull String archiveName) throws IOException;
+
+ /**
+ * Creates a new archive.
+ *
+ * @param archiveName
+ * @return the archive writer
+ */
+ @Nonnull
+ SegmentArchiveWriter create(@Nonnull String archiveName) throws IOException;
+
+ /**
+ * Deletes the archive if exists.
+ *
+ * @param archiveName
+ * @return true if the archive was removed, false otherwise
+ */
+ boolean delete(@Nonnull String archiveName);
+
+ /**
+ * Renames the archive.
+ *
+ * @param from the existing archive
+ * @param to new name
+ * @return true if the archive was renamed, false otherwise
+ */
+ boolean renameTo(@Nonnull String from, @Nonnull String to);
+
+ /**
+ * Copies the archive with all the segments.
+ *
+ * @param from the existing archive
+ * @param to new name
+ */
+ void copyFile(@Nonnull String from, @Nonnull String to) throws IOException;
+
+ /**
+ * Check if archive exists.
+ *
+ * @param archiveName archive to check
+ * @return true if archive exists, false otherwise
+ */
+ boolean exists(@Nonnull String archiveName);
+
+ /**
+ * Finds all the segments included in the archive.
+ *
+ * @param archiveName archive to recover
+ * @param entries results will be put there, in the order of presence in the
+ * archive
+ */
+ void recoverEntries(@Nonnull String archiveName, @Nonnull LinkedHashMap<UUID, byte[]> entries) throws IOException;
+
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveReader.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveReader.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveReader.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public interface SegmentArchiveReader {
+
+ /**
+ * Read the segment.
+ *
+ * @param msb
+ * @param lsb
+ * @return byte buffer containing the segment data or null if segment doesn't exist
+ */
+ @Nullable
+ ByteBuffer readSegment(long msb, long lsb) throws IOException;
+
+ /**
+ * Check if the segment exists.
+ *
+ * @param msb
+ * @param lsb
+ * @return true if the segment exists
+ */
+ boolean containsSegment(long msb, long lsb);
+
+ /**
+ * List all the segments, in the order as they have been written to the archive.
+ *
+ * @return segment list, ordered by their position in the archive
+ */
+ List<SegmentArchiveEntry> listSegments();
+
+ /**
+ * Loads and returns the graph.
+ *
+ * @return the segment graph or null if the persisted graph doesn't exist.
+ */
+ @Nullable
+ ByteBuffer getGraph() throws IOException;
+
+ /**
+ * Check if the persisted graph exists.
+ *
+ * @return true if the graph exists, false otherwise
+ */
+ boolean hasGraph();
+
+ /**
+ * Loads and returns the binary references.
+ *
+ * @return binary references
+ */
+ @Nonnull
+ ByteBuffer getBinaryReferences() throws IOException;
+
+ /**
+ * Get the current length of the archive.
+ *
+ * @return length of the archive, in bytes
+ */
+ long length();
+
+ /**
+ * Get the name of the archive.
+ *
+ * @return archive name
+ */
+ @Nonnull
+ String getName();
+
+ /**
+ * Close the archive.
+ */
+ void close() throws IOException;
+
+ /**
+ * Returns the size of the entry
+ * @param size
+ * @return
+ */
+ int getEntrySize(int size);
+}
Added: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveWriter.java?rev=1827291&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveWriter.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentArchiveWriter.java Tue Mar 20 10:53:44 2018
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.segment.spi.persistence;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * Allows to write in the new archive.
+ */
+public interface SegmentArchiveWriter {
+
+ /**
+ * Write the new segment to the archive.
+ *
+ * @param msb
+ * @param lsb
+ * @param data
+ * @param offset
+ * @param size
+ * @param generation
+ * @param fullGeneration
+ * @param isCompacted
+ * @return the entry representing the new segment. Can be later used for the {@link #readSegment(long, long)} method.
+ */
+ @Nonnull
+ void writeSegment(long msb, long lsb, @Nonnull byte[] data, int offset, int size, int generation, int fullGeneration, boolean isCompacted) throws IOException;
+
+ /**
+ * Read the segment.
+ *
+ * @param msb
+ * @param lsb
+ * @return byte buffer containing the segment data or null if segment doesn't exist
+ */
+ @Nullable
+ ByteBuffer readSegment(long msb, long lsb) throws IOException;
+
+ /**
+ * Check if the segment exists.
+ *
+ * @param msb
+ * @param lsb
+ * @return true if the segment exists
+ */
+ boolean containsSegment(long msb, long lsb);
+
+ /**
+ * Write the graph data.
+ *
+ * @param data
+ */
+ void writeGraph(@Nonnull byte[] data) throws IOException;
+
+ /**
+ * Write the binary references data.
+ *
+ * @param data
+ */
+ void writeBinaryReferences(@Nonnull byte[] data) throws IOException;
+
+ /**
+ * Get the current length of the archive.
+ *
+ * @return length of the archive, in bytes
+ */
+ long getLength();
+
+ /**
+ * Close the archive.
+ */
+ void close() throws IOException;
+
+ /**
+ * Check if the archive has been created (eg. something has been written).
+ *
+ * @return true if the archive has been created, false otherwise
+ */
+ boolean isCreated();
+
+ /**
+ * Flush all the data to the storage.
+ */
+ void flush() throws IOException;
+
+ /**
+ * Get the name of the archive.
+ *
+ * @return archive name
+ */
+ @Nonnull
+ String getName();
+}
Copied: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentNodeStorePersistence.java (from r1827287, jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStorePersistence.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentNodeStorePersistence.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentNodeStorePersistence.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStorePersistence.java&r1=1827287&r2=1827291&rev=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStorePersistence.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/spi/persistence/SegmentNodeStorePersistence.java Tue Mar 20 10:53:44 2018
@@ -16,15 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.jackrabbit.oak.segment;
+package org.apache.jackrabbit.oak.segment.spi.persistence;
-import org.apache.jackrabbit.oak.segment.file.tar.FileStoreMonitor;
-import org.apache.jackrabbit.oak.segment.file.tar.IOMonitor;
+import org.apache.jackrabbit.oak.segment.spi.monitor.FileStoreMonitor;
+import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitor;
-import java.io.Closeable;
import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
public interface SegmentNodeStorePersistence {
@@ -40,52 +37,4 @@ public interface SegmentNodeStorePersist
RepositoryLock lockRepository() throws IOException;
- interface JournalFile {
-
- JournalFileReader openJournalReader() throws IOException;
-
- JournalFileWriter openJournalWriter() throws IOException;
-
- String getName();
-
- boolean exists();
- }
-
- interface JournalFileReader extends Closeable {
-
- String readLine() throws IOException;
-
- }
-
- interface JournalFileWriter extends Closeable {
-
- void truncate() throws IOException;
-
- void writeLine(String line) throws IOException;
-
- }
-
- interface GCJournalFile {
-
- void writeLine(String line) throws IOException;
-
- List<String> readLines() throws IOException;
-
- }
-
- interface ManifestFile {
-
- boolean exists();
-
- Properties load() throws IOException;
-
- void save(Properties properties) throws IOException;
-
- }
-
- interface RepositoryLock {
-
- void unlock() throws IOException;
-
- }
}
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Compact.java Tue Mar 20 10:53:44 2018
@@ -39,8 +39,8 @@ import javax.annotation.Nullable;
import com.google.common.base.Stopwatch;
import org.apache.jackrabbit.oak.segment.SegmentCache;
-import org.apache.jackrabbit.oak.segment.SegmentNodeStorePersistence.JournalFile;
-import org.apache.jackrabbit.oak.segment.SegmentNodeStorePersistence.JournalFileWriter;
+import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFile;
+import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFileWriter;
import org.apache.jackrabbit.oak.segment.file.FileStore;
import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/History.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/History.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/History.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/History.java Tue Mar 20 10:53:44 2018
@@ -23,7 +23,7 @@ import static com.google.common.base.Pre
import java.io.File;
import java.util.Iterator;
-import org.apache.jackrabbit.oak.segment.SegmentNodeStorePersistence.JournalFile;
+import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFile;
import org.apache.jackrabbit.oak.segment.file.tar.LocalJournalFile;
import org.apache.jackrabbit.oak.segment.file.tooling.RevisionHistory;
import org.apache.jackrabbit.oak.segment.file.tooling.RevisionHistory.HistoryElement;
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Utils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Utils.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Utils.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Utils.java Tue Mar 20 10:53:44 2018
@@ -30,7 +30,7 @@ import javax.annotation.Nonnull;
import com.google.common.base.Function;
import com.google.common.collect.Iterators;
-import org.apache.jackrabbit.oak.segment.SegmentNodeStorePersistence.JournalFile;
+import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFile;
import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
import org.apache.jackrabbit.oak.segment.file.JournalEntry;
import org.apache.jackrabbit.oak.segment.file.JournalReader;
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/GcJournalTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/GcJournalTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/GcJournalTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/GcJournalTest.java Tue Mar 20 10:53:44 2018
@@ -33,7 +33,8 @@ import java.util.List;
import org.apache.jackrabbit.oak.commons.IOUtils;
import org.apache.jackrabbit.oak.segment.RecordId;
-import org.apache.jackrabbit.oak.segment.SegmentNodeStorePersistence;
+import org.apache.jackrabbit.oak.segment.spi.persistence.GCJournalFile;
+import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentNodeStorePersistence;
import org.apache.jackrabbit.oak.segment.file.GCJournal.GCJournalEntry;
import org.apache.jackrabbit.oak.segment.file.tar.TarPersistence;
import org.junit.Rule;
@@ -85,7 +86,7 @@ public class GcJournalTest {
Collection<GCJournalEntry> all = gc.readAll();
assertEquals(all.size(), 3);
- SegmentNodeStorePersistence.GCJournalFile gcFile = getPersistence().getGCJournalFile();
+ GCJournalFile gcFile = getPersistence().getGCJournalFile();
List<String> allLines = gcFile.readLines();
assertEquals(allLines.size(), 3);
}
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/ManifestCheckerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/ManifestCheckerTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/ManifestCheckerTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/ManifestCheckerTest.java Tue Mar 20 10:53:44 2018
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEqu
import java.io.File;
import java.nio.file.Files;
-import org.apache.jackrabbit.oak.segment.SegmentNodeStorePersistence.ManifestFile;
+import org.apache.jackrabbit.oak.segment.spi.persistence.ManifestFile;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/SizeDeltaGCEstimationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/SizeDeltaGCEstimationTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/SizeDeltaGCEstimationTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/SizeDeltaGCEstimationTest.java Tue Mar 20 10:53:44 2018
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertTru
import java.io.File;
-import org.apache.jackrabbit.oak.segment.SegmentNodeStorePersistence;
+import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentNodeStorePersistence;
import org.apache.jackrabbit.oak.segment.file.tar.TarPersistence;
import org.junit.Before;
import org.junit.Rule;
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/TarRevisionsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/TarRevisionsTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/TarRevisionsTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/TarRevisionsTest.java Tue Mar 20 10:53:44 2018
@@ -45,7 +45,7 @@ import com.google.common.util.concurrent
import org.apache.jackrabbit.oak.segment.RecordId;
import org.apache.jackrabbit.oak.segment.SegmentNodeBuilder;
import org.apache.jackrabbit.oak.segment.SegmentNodeState;
-import org.apache.jackrabbit.oak.segment.SegmentNodeStorePersistence;
+import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentNodeStorePersistence;
import org.apache.jackrabbit.oak.segment.SegmentReader;
import org.apache.jackrabbit.oak.segment.file.tar.TarPersistence;
import org.junit.After;
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFileTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFileTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFileTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFileTest.java Tue Mar 20 10:53:44 2018
@@ -36,7 +36,10 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import org.apache.jackrabbit.oak.segment.SegmentArchiveManager;
+import org.apache.jackrabbit.oak.segment.spi.monitor.FileStoreMonitorAdapter;
+import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter;
+import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveEntry;
+import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveManager;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -93,8 +96,8 @@ public class TarFileTest {
}
try (TarReader reader = TarReader.open("data00000a.tar", archiveManager)) {
- TarEntry[] entries = reader.getEntries();
- assertEquals(newGCGeneration(1, 2, false), entries[0].generation());
+ SegmentArchiveEntry[] entries = reader.getEntries();
+ assertEquals(newGCGeneration(1, 2, false), newGCGeneration(entries[0]));
}
}
@@ -111,8 +114,8 @@ public class TarFileTest {
}
try (TarReader reader = TarReader.open("data00000a.tar", archiveManager)) {
- TarEntry[] entries = reader.getEntries();
- assertEquals(newGCGeneration(1, 2, true), entries[0].generation());
+ SegmentArchiveEntry[] entries = reader.getEntries();
+ assertEquals(newGCGeneration(1, 2, true), newGCGeneration(entries[0]));
}
}
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFilesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFilesTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFilesTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarFilesTest.java Tue Mar 20 10:53:44 2018
@@ -42,6 +42,8 @@ import java.util.Set;
import java.util.UUID;
import org.apache.jackrabbit.oak.segment.file.tar.TarFiles.CleanupResult;
+import org.apache.jackrabbit.oak.segment.spi.monitor.FileStoreMonitorAdapter;
+import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriterTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriterTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriterTest.java Tue Mar 20 10:53:44 2018
@@ -29,7 +29,9 @@ import java.io.File;
import java.io.IOException;
import java.util.UUID;
-import org.apache.jackrabbit.oak.segment.SegmentArchiveManager;
+import org.apache.jackrabbit.oak.segment.spi.monitor.FileStoreMonitorAdapter;
+import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter;
+import org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveManager;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderTest.java Tue Mar 20 10:53:44 2018
@@ -50,12 +50,13 @@ public class BinaryReferencesIndexLoader
}
private static BinaryReferencesIndex loadIndex(ByteBuffer buffer) throws Exception {
- return BinaryReferencesIndexLoader.loadBinaryReferencesIndex((whence, length) -> {
+ ByteBuffer data = BinaryReferencesIndexLoader.loadBinaryReferencesIndex((whence, length) -> {
ByteBuffer slice = buffer.duplicate();
slice.position(slice.limit() - whence);
slice.limit(slice.position() + length);
return slice.slice();
});
+ return BinaryReferencesIndexLoader.parseBinaryReferencesIndex(data);
}
@Test(expected = InvalidBinaryReferencesIndexException.class)
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1Test.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1Test.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1Test.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV1Test.java Tue Mar 20 10:53:44 2018
@@ -20,6 +20,7 @@ package org.apache.jackrabbit.oak.segmen
import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoaderV1.FOOTER_SIZE;
import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoaderV1.MAGIC;
import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoaderV1.loadBinaryReferencesIndex;
+import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoaderV1.parseBinaryReferencesIndex;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -40,12 +41,13 @@ public class BinaryReferencesIndexLoader
}
private static BinaryReferencesIndex loadIndex(ByteBuffer buffer) throws Exception {
- return loadBinaryReferencesIndex((whence, length) -> {
+ ByteBuffer data = loadBinaryReferencesIndex((whence, length) -> {
ByteBuffer slice = buffer.duplicate();
slice.position(slice.limit() - whence);
slice.limit(slice.position() + length);
return slice.slice();
});
+ return parseBinaryReferencesIndex(data);
}
private static void assertInvalidBinaryReferencesIndexException(ByteBuffer buffer, String message) throws Exception {
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2Test.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2Test.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2Test.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexLoaderV2Test.java Tue Mar 20 10:53:44 2018
@@ -20,6 +20,7 @@ package org.apache.jackrabbit.oak.segmen
import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoaderV2.FOOTER_SIZE;
import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoaderV2.MAGIC;
import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoaderV2.loadBinaryReferencesIndex;
+import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoaderV2.parseBinaryReferencesIndex;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -40,12 +41,13 @@ public class BinaryReferencesIndexLoader
}
private static BinaryReferencesIndex loadIndex(ByteBuffer buffer) throws Exception {
- return loadBinaryReferencesIndex((whence, length) -> {
+ ByteBuffer data = loadBinaryReferencesIndex((whence, length) -> {
ByteBuffer slice = buffer.duplicate();
slice.position(slice.limit() - whence);
slice.limit(slice.position() + length);
return slice.slice();
});
+ return parseBinaryReferencesIndex(data);
}
private static void assertInvalidBinaryReferencesIndexException(ByteBuffer buffer, String message) throws Exception {
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriterTest.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriterTest.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tar/binaries/BinaryReferencesIndexWriterTest.java Tue Mar 20 10:53:44 2018
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.segmen
import static java.util.Arrays.asList;
import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoader.loadBinaryReferencesIndex;
+import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexLoader.parseBinaryReferencesIndex;
import static org.apache.jackrabbit.oak.segment.file.tar.binaries.BinaryReferencesIndexWriter.newBinaryReferencesIndexWriter;
import static org.junit.Assert.assertEquals;
@@ -52,7 +53,8 @@ public class BinaryReferencesIndexWriter
byte[] data = writer.write();
- BinaryReferencesIndex index = loadBinaryReferencesIndex((whence, length) -> ByteBuffer.wrap(data, data.length - whence, length));
+ ByteBuffer buffer = loadBinaryReferencesIndex((whence, length) -> ByteBuffer.wrap(data, data.length - whence, length));
+ BinaryReferencesIndex index = parseBinaryReferencesIndex(buffer);
Generation g1 = new Generation(1, 2, false);
Generation g2 = new Generation(3, 4, true);
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/upgrade/UpgradeIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/upgrade/UpgradeIT.java?rev=1827291&r1=1827290&r2=1827291&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/upgrade/UpgradeIT.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/upgrade/UpgradeIT.java Tue Mar 20 10:53:44 2018
@@ -40,7 +40,7 @@ import org.apache.jackrabbit.oak.segment
import org.apache.jackrabbit.oak.segment.data.SegmentData;
import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
import org.apache.jackrabbit.oak.segment.file.LocalManifestFile;
-import org.apache.jackrabbit.oak.segment.file.tar.IOMonitorAdapter;
+import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter;
import org.apache.jackrabbit.oak.segment.file.tar.TarFiles;
import org.apache.jackrabbit.oak.segment.tool.Compact;
import org.junit.Before;