cache: allow partial caches to load
This commit is contained in:
@@ -112,6 +112,11 @@ public class DiskStorage implements Storage
|
|||||||
public byte[] readIndex(int indexId) throws IOException
|
public byte[] readIndex(int indexId) throws IOException
|
||||||
{
|
{
|
||||||
IndexEntry entry = index255.read(indexId);
|
IndexEntry entry = index255.read(indexId);
|
||||||
|
if (entry == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
byte[] indexData = data.read(index255.getIndexFileId(), entry.getId(), entry.getSector(), entry.getLength());
|
byte[] indexData = data.read(index255.getIndexFileId(), entry.getId(), entry.getSector(), entry.getLength());
|
||||||
return indexData;
|
return indexData;
|
||||||
}
|
}
|
||||||
@@ -121,6 +126,11 @@ public class DiskStorage implements Storage
|
|||||||
logger.trace("Loading index {}", index.getId());
|
logger.trace("Loading index {}", index.getId());
|
||||||
|
|
||||||
byte[] indexData = readIndex(index.getId());
|
byte[] indexData = readIndex(index.getId());
|
||||||
|
if (indexData == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Container res = Container.decompress(indexData, null);
|
Container res = Container.decompress(indexData, null);
|
||||||
byte[] data = res.data;
|
byte[] data = res.data;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user