improved naming
This commit is contained in:
parent
cffc659001
commit
663089a7a3
@ -168,7 +168,7 @@ public class ConfigPOJO implements ConfigData {
|
||||
Very Permissible mode will skip the verification process. THIS MOST CERTAINLY WILL LEAD TO DATA LOSS OR CORRUPTION
|
||||
""")
|
||||
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
|
||||
public ErrorHandlingMode errorErrorHandlingMode = ErrorHandlingMode.STRICT;
|
||||
public IntegrityVerificationMode integrityVerificationMode = IntegrityVerificationMode.STRICT;
|
||||
|
||||
@Override
|
||||
public void validatePostLoad() throws ValidationException {
|
||||
@ -185,7 +185,7 @@ public class ConfigPOJO implements ConfigData {
|
||||
}
|
||||
}
|
||||
|
||||
public enum ErrorHandlingMode {
|
||||
public enum IntegrityVerificationMode {
|
||||
STRICT,
|
||||
PERMISSIBLE,
|
||||
VERY_PERMISSIBLE;
|
||||
|
@ -30,7 +30,7 @@ import java.util.Optional;
|
||||
|
||||
public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles, LocalDateTime date, long startTimestamp, long finishTimestamp, String version) implements Serializable {
|
||||
public static final String DATA_FILENAME = "textile_status.data";
|
||||
public Optional<String> isValid(long hash, RestoreContext ctx) throws RuntimeException {
|
||||
public Optional<String> validate(long hash, RestoreContext ctx) throws RuntimeException {
|
||||
if(hash != treeHash)
|
||||
return Optional.of("Tree Hash mismatch!\n Expected: " + treeHash + ", got: " + hash);
|
||||
|
||||
@ -47,8 +47,10 @@ public record CompressionStatus(long treeHash, Map<Path, Exception> brokenFiles,
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public static CompressionStatus readFromFile(Path folder) throws IOException, ClassNotFoundException {
|
||||
try(InputStream i = Files.newInputStream(folder.resolve(DATA_FILENAME));
|
||||
public static Path resolveStatusFilename(Path directory) { return directory.resolve(DATA_FILENAME); }
|
||||
|
||||
public static CompressionStatus readFromFile(Path directory) throws IOException, ClassNotFoundException {
|
||||
try(InputStream i = Files.newInputStream(directory.resolve(DATA_FILENAME));
|
||||
ObjectInputStream obj = new ObjectInputStream(i)) {
|
||||
return (CompressionStatus) obj.readObject();
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class MakeBackupRunnable implements Callable<Void> {
|
||||
//ExecutorService swallows exception, so I need to catch everything
|
||||
log.error("An exception occurred when trying to create new backup file!", e);
|
||||
|
||||
if (ConfigHelper.INSTANCE.get().errorErrorHandlingMode.isStrict()) {
|
||||
if (ConfigHelper.INSTANCE.get().integrityVerificationMode.isStrict()) {
|
||||
try {
|
||||
Files.delete(outFile);
|
||||
} catch (IOException ex) {
|
||||
|
@ -86,7 +86,7 @@ public abstract class AbstractCompressor {
|
||||
} catch (IOException e) {
|
||||
brokenFileHandler.handle(file, e);
|
||||
//In Permissive mode we allow partial backups
|
||||
if(ConfigHelper.INSTANCE.get().errorErrorHandlingMode.isStrict()) throw e;
|
||||
if (ConfigHelper.INSTANCE.get().integrityVerificationMode.isStrict()) throw e;
|
||||
else log.sendErrorAL(ctx, "An exception occurred while trying to compress: {}",
|
||||
inputFile.relativize(file).toString(), e
|
||||
);
|
||||
|
@ -47,8 +47,8 @@
|
||||
"text.autoconfig.textile_backup.option.format": "Archive and compression format",
|
||||
"text.autoconfig.textile_backup.option.format.@Tooltip": "See: https://github.com/Szum123321/textile_backup/wiki/Configuration#format",
|
||||
|
||||
"text.autoconfig.textile_backup.option.errorErrorHandlingMode": "Compression error handling mode",
|
||||
"text.autoconfig.textile_backup.option.errorErrorHandlingMode.@Tooltip": "DO NOT ALTER unless fully certain",
|
||||
"text.autoconfig.textile_backup.option.integrityVerificationMode": "Verify the backup file has not been damaged",
|
||||
"text.autoconfig.textile_backup.option.integrityVerificationMode.@Tooltip": "DO NOT ALTER unless fully certain",
|
||||
|
||||
"text.autoconfig.textile_backup.option.permissionLevel": "Min permission level",
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user