Rename FileSponge
This commit is contained in:
parent
91694960e4
commit
f0eba9f4f4
@ -30,6 +30,6 @@ public class DataBlock {
|
|||||||
|
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return offset / Web.BLOCK_SIZE;
|
return offset / FileSponge.BLOCK_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package org.warp.filesponge;
|
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 com.google.common.primitives.Ints;
|
||||||
import it.cavallium.dbengine.database.Column;
|
import it.cavallium.dbengine.database.Column;
|
||||||
|
@ -51,7 +51,7 @@ public class DiskMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getBlocksCount() {
|
private int getBlocksCount() {
|
||||||
var expectedBlocksCount = getBlocksCount(size, Web.BLOCK_SIZE);
|
var expectedBlocksCount = getBlocksCount(size, FileSponge.BLOCK_SIZE);
|
||||||
if (this.getDownloadedBlocks().size() != expectedBlocksCount) {
|
if (this.getDownloadedBlocks().size() != expectedBlocksCount) {
|
||||||
throw new IllegalStateException("Blocks array length != expected blocks count");
|
throw new IllegalStateException("Blocks array length != expected blocks count");
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ public class DiskMetadata {
|
|||||||
var bais = new ByteArrayInputStream(serialized);
|
var bais = new ByteArrayInputStream(serialized);
|
||||||
var dis = new DataInputStream(bais);
|
var dis = new DataInputStream(bais);
|
||||||
int size = dis.readInt();
|
int size = dis.readInt();
|
||||||
int blocksCount = getBlocksCount(size, Web.BLOCK_SIZE);
|
int blocksCount = getBlocksCount(size, FileSponge.BLOCK_SIZE);
|
||||||
boolean[] downloadedBlocks = new boolean[blocksCount];
|
boolean[] downloadedBlocks = new boolean[blocksCount];
|
||||||
for (int i = 0; i < blocksCount; i++) {
|
for (int i = 0; i < blocksCount; i++) {
|
||||||
downloadedBlocks[i] = dis.readBoolean();
|
downloadedBlocks[i] = dis.readBoolean();
|
||||||
|
@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
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 BLOCK_SIZE = 8 * 1024 * 1024; // 8 MiB
|
||||||
public static final int MAX_BLOCKS = 256; // 2 GiB
|
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<URLsDiskHandler> cacheAccess = new ConcurrentHashMap<URLsDiskHandler, Object>().keySet(new Object());
|
||||||
private final Set<URLsWriter> cacheWrite = new ConcurrentHashMap<URLsWriter, Object>().keySet(new Object());
|
private final Set<URLsWriter> cacheWrite = new ConcurrentHashMap<URLsWriter, Object>().keySet(new Object());
|
||||||
|
|
||||||
public Web() {
|
public FileSponge() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user