* 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;
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
}
* 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;
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;
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;
* 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();
* 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();
* @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());
}
* @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);
}
* @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);