Move InputOutputStreamFactory 77/116177/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 8 Apr 2025 08:46:04 +0000 (10:46 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 8 Apr 2025 08:46:04 +0000 (10:46 +0200)
This class is only used by LocalSnapshotStore, move it to the same
package.

Change-Id: I3caceae1b54672c0a09655c6d1d7b86c8c5b7151
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/InputOutputStreamFactory.java [moved from raft/raft-spi/src/main/java/org/opendaylight/raft/spi/InputOutputStreamFactory.java with 92% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LZ4InputOutputStreamSupport.java [moved from raft/raft-spi/src/main/java/org/opendaylight/raft/spi/LZ4InputOutputStreamSupport.java with 91% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/PlainInputOutputStreamSupport.java [moved from raft/raft-spi/src/main/java/org/opendaylight/raft/spi/PlainInputOutputStreamSupport.java with 91% similarity]
raft/raft-spi/src/main/java/org/opendaylight/raft/spi/Lz4Support.java

similarity index 92%
rename from raft/raft-spi/src/main/java/org/opendaylight/raft/spi/InputOutputStreamFactory.java
rename to opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/InputOutputStreamFactory.java
index 7e6f62af32c81da4a307dcdd3eeb827abb1759a9..16ee65ee77060b7cba83b7ab4a10d7b78acf23db 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.raft.spi;
+package org.opendaylight.controller.cluster.persistence;
 
 import static java.util.Objects.requireNonNull;
 
@@ -20,12 +20,13 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.opendaylight.raft.spi.Lz4BlockSize;
+import org.opendaylight.raft.spi.StreamSource;
 
 /**
  * Support for opening {@link InputStream}s -- be it {@link #simple()} or {@link #lz4(Lz4BlockSize)}.
  */
-public abstract sealed class InputOutputStreamFactory
-        permits LZ4InputOutputStreamSupport, PlainInputOutputStreamSupport {
+abstract sealed class InputOutputStreamFactory permits LZ4InputOutputStreamSupport, PlainInputOutputStreamSupport {
     InputOutputStreamFactory() {
         // Hidden on purpose
     }
similarity index 91%
rename from raft/raft-spi/src/main/java/org/opendaylight/raft/spi/LZ4InputOutputStreamSupport.java
rename to opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LZ4InputOutputStreamSupport.java
index 6ec6495d7f788e3a9411caaf5273134d18ee9aed..da3a9ea6bcf25609bc17acf01c104f59a0606eb5 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.raft.spi;
+package org.opendaylight.controller.cluster.persistence;
 
 import static java.util.Objects.requireNonNull;
 
@@ -16,6 +16,9 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.file.Files;
 import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.raft.spi.Lz4BlockSize;
+import org.opendaylight.raft.spi.Lz4Support;
+import org.opendaylight.raft.spi.StreamSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index 1c80b38a2a8d5af927c244eaaaa48cab02825201..a9814ec06573be2f9d18d9ffe058923093656403 100644 (file)
@@ -43,7 +43,6 @@ import org.apache.pekko.persistence.snapshot.japi.SnapshotStore;
 import org.apache.pekko.serialization.JavaSerializer;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.raft.spi.FileStreamSource;
-import org.opendaylight.raft.spi.InputOutputStreamFactory;
 import org.opendaylight.raft.spi.Lz4BlockSize;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -5,13 +5,14 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.raft.spi;
+package org.opendaylight.controller.cluster.persistence;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.raft.spi.StreamSource;
 
 final class PlainInputOutputStreamSupport extends InputOutputStreamFactory {
     static final @NonNull PlainInputOutputStreamSupport INSTANCE = new PlainInputOutputStreamSupport();
index c7ff8e39573cf965ec43eb252660124a8a948106..01be8b1c49564632daf67ea3fb35501259cabbbe 100644 (file)
@@ -23,7 +23,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
  * Utilities supporting LZ4 compression and decompression.
  */
 @NonNullByDefault
-final class Lz4Support {
+public final class Lz4Support {
     private static final LZ4Factory LZ4_FACTORY = LZ4Factory.fastestInstance();
     private static final XXHashFactory HASH_FACTORY = XXHashFactory.fastestInstance();
 
@@ -39,7 +39,7 @@ final class Lz4Support {
      * @return an InputStream
      * @throws IOException if an I/O error occurs
      */
-    static InputStream newDecompressInputStream(final InputStream in) throws IOException {
+    public static InputStream newDecompressInputStream(final InputStream in) throws IOException {
         return new LZ4FrameInputStream(requireNonNull(in), LZ4_FACTORY.safeDecompressor(), HASH_FACTORY.hash32());
     }
 
@@ -55,7 +55,7 @@ final class Lz4Support {
      * @return an OutputStream
      * @throws IOException if an I/O error occurs
      */
-    static OutputStream newCompressOutputStream(final OutputStream out, final Lz4BlockSize blockSize)
+    public static OutputStream newCompressOutputStream(final OutputStream out, final Lz4BlockSize blockSize)
             throws IOException {
         return newCompressOutputStream(out, blockSize, -1);
     }
@@ -69,7 +69,7 @@ final class Lz4Support {
      * @return an OutputStream
      * @throws IOException if an I/O error occurs
      */
-    static OutputStream newCompressOutputStream(final OutputStream out, final Lz4BlockSize blockSize,
+    public static OutputStream newCompressOutputStream(final OutputStream out, final Lz4BlockSize blockSize,
             final long knownSize) throws IOException {
         return new LZ4FrameOutputStream(requireNonNull(out), blockSize.libArgument(), knownSize,
             LZ4_FACTORY.fastCompressor(), HASH_FACTORY.hash32(), Bits.BLOCK_INDEPENDENCE);