Fix disk cache impl

This commit is contained in:
Andrea Cavalli 2023-07-25 12:24:10 +02:00
parent ec093acbc2
commit bf8d6ee38f
2 changed files with 25 additions and 1 deletions

View File

@ -31,7 +31,7 @@ import java.util.function.Predicate;
import java.util.stream.Stream; import java.util.stream.Stream;
import reactor.util.function.Tuple2; import reactor.util.function.Tuple2;
public interface DiskCache extends URLsDiskHandler, URLsWriter, SafeCloseable { public interface DiskCache extends URLsDiskHandler, URLsWriter, SafeCloseable, IBackuppable {
void writeMetadataSync(URL url, Metadata metadata); void writeMetadataSync(URL url, Metadata metadata);

View File

@ -24,6 +24,7 @@ import static org.warp.filesponge.FileSponge.BLOCK_SIZE;
import it.cavallium.buffer.Buf; import it.cavallium.buffer.Buf;
import it.cavallium.buffer.BufDataInput; import it.cavallium.buffer.BufDataInput;
import it.cavallium.buffer.BufDataOutput; import it.cavallium.buffer.BufDataOutput;
import it.cavallium.dbengine.client.IBackuppable;
import it.cavallium.dbengine.database.LLDictionary; import it.cavallium.dbengine.database.LLDictionary;
import it.cavallium.dbengine.database.LLDictionaryResultType; import it.cavallium.dbengine.database.LLDictionaryResultType;
import it.cavallium.dbengine.database.LLKeyValueDatabase; import it.cavallium.dbengine.database.LLKeyValueDatabase;
@ -303,4 +304,27 @@ class DiskCacheImpl implements DiskCache {
ownedDb.close(); ownedDb.close();
} }
} }
@Override
public void pauseForBackup() {
if (ownedDb != null) {
ownedDb.pauseForBackup();
}
}
@Override
public void resumeAfterBackup() {
if (ownedDb != null) {
ownedDb.resumeAfterBackup();
}
}
@Override
public boolean isPaused() {
if (ownedDb != null) {
return ownedDb.isPaused();
} else {
return false;
}
}
} }