all works now*. more debugging still needed.

2.x
Szum123321 2022-11-29 15:05:51 +01:00
parent 86ae95b02e
commit 4622f3fd0d
4 changed files with 54 additions and 57 deletions

View File

@ -18,8 +18,6 @@
package net.szum123321.textile_backup.core;
import net.fabricmc.loader.api.Version;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
@ -27,10 +25,10 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;
public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp, Version modVersion) implements Serializable {
public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp) implements Serializable {
public static final String DATA_FILENAME = "textile_status.data";
public boolean isValid(long decompressedHash) {
return decompressedHash == treeHash;
return decompressedHash == treeHash && brokenFiles.isEmpty();
}
public static CompressionStatus readFromFile(Path folder) throws IOException, ClassNotFoundException {
@ -57,7 +55,7 @@ public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles,
.append(date.format(DateTimeFormatter.ISO_DATE_TIME))
.append(", start time stamp: ").append(startTimestamp)
.append(", finish time stamp: ").append(finishTimestamp)
.append(", Mod Version:").append(modVersion.getFriendlyString());
;//.append(", Mod Version: ").append(modVersion.getFriendlyString());
builder.append(", broken files: ");
if(brokenFiles.isEmpty()) builder.append("[]");

View File

@ -97,8 +97,8 @@ public abstract class AbstractCompressor {
CompressionStatus status = new CompressionStatus (
fileHashBuilder.getValue(),
brokenFileHandler.get(),
ctx.startDate(), start.toEpochMilli(), now.toEpochMilli(),
TextileBackup.VERSION
ctx.startDate(), start.toEpochMilli(), now.toEpochMilli()//,
//TextileBackup.VERSION
);
addEntry(new StatusFileInputSupplier(status.serialize()), arc);

View File

@ -37,7 +37,6 @@ public class BalticHash implements Hash {
protected final byte[] _byte_buffer = new byte[(state.length + 1) * Long.BYTES];
//Enforce endianness
protected final ByteBuffer buffer = ByteBuffer.wrap(_byte_buffer).order(ByteOrder.LITTLE_ENDIAN);
protected long hashed_data_length = 0;
public void update(byte b) {

View File

@ -33,10 +33,10 @@ It's still probably far from being the slowest part of code, so I don't expect a
I will keep this code here for future work perhaps
*/
public class BalticHashSIMD extends BalticHash {
public class BalticHashSIMD extends BalticHash {/*
public BalticHashSIMD() { throw new UnsupportedOperationException(); } //For safety
/* private LongVector state = LongVector.fromArray(LongVector.SPECIES_256, IV, 0);
private LongVector state = LongVector.fromArray(LongVector.SPECIES_256, IV, 0);
@Override
public long getValue() {