Rename FileSponge

This commit is contained in:
Andrea Cavalli 2021-03-07 15:51:54 +01:00
parent 91694960e4
commit f0eba9f4f4
4 changed files with 6 additions and 6 deletions

View File

@ -30,6 +30,6 @@ public class DataBlock {
public int getId() {
return offset / Web.BLOCK_SIZE;
return offset / FileSponge.BLOCK_SIZE;
}
}

View File

@ -18,7 +18,7 @@
package org.warp.filesponge;
import static org.warp.filesponge.Web.BLOCK_SIZE;
import static org.warp.filesponge.FileSponge.BLOCK_SIZE;
import com.google.common.primitives.Ints;
import it.cavallium.dbengine.database.Column;

View File

@ -51,7 +51,7 @@ public class DiskMetadata {
}
private int getBlocksCount() {
var expectedBlocksCount = getBlocksCount(size, Web.BLOCK_SIZE);
var expectedBlocksCount = getBlocksCount(size, FileSponge.BLOCK_SIZE);
if (this.getDownloadedBlocks().size() != expectedBlocksCount) {
throw new IllegalStateException("Blocks array length != expected blocks count");
}
@ -74,7 +74,7 @@ public class DiskMetadata {
var bais = new ByteArrayInputStream(serialized);
var dis = new DataInputStream(bais);
int size = dis.readInt();
int blocksCount = getBlocksCount(size, Web.BLOCK_SIZE);
int blocksCount = getBlocksCount(size, FileSponge.BLOCK_SIZE);
boolean[] downloadedBlocks = new boolean[blocksCount];
for (int i = 0; i < blocksCount; i++) {
downloadedBlocks[i] = dis.readBoolean();

View File

@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public class Web implements URLsHandler {
public class FileSponge implements URLsHandler {
public static final int BLOCK_SIZE = 8 * 1024 * 1024; // 8 MiB
public static final int MAX_BLOCKS = 256; // 2 GiB
@ -33,7 +33,7 @@ public class Web implements URLsHandler {
private final Set<URLsDiskHandler> cacheAccess = new ConcurrentHashMap<URLsDiskHandler, Object>().keySet(new Object());
private final Set<URLsWriter> cacheWrite = new ConcurrentHashMap<URLsWriter, Object>().keySet(new Object());
public Web() {
public FileSponge() {
}