Align persisted Chronicle Map creation with Size Prefixed Blob and Self-Bootstrapping Header specifications

This commit is contained in:
leventov
2016-02-05 16:46:12 +07:00
parent 01f15fb9b1
commit 7b9ccac147
5 changed files with 290 additions and 77 deletions
@@ -378,9 +378,9 @@ public abstract class VanillaChronicleHash<K,
}
}
public final void initBeforeMapping(File file, FileChannel ch, long headerSize)
public final void initBeforeMapping(File file, FileChannel ch, long headerEnd)
throws IOException {
this.headerSize = roundUpMapHeaderSize(headerSize);
this.headerSize = roundUpMapHeaderSize(headerEnd);
if (!createdOrInMemory) {
// This block is for reading segmentHeadersOffset before main mapping
// After the mapping globalMutableState value's bytes are reassigned
@@ -774,6 +774,10 @@ public abstract class VanillaChronicleHash<K,
globalMutableState.setFirstFreeTierIndex(firstTierIndex);
}
public void msync(RandomAccessFile raf) throws IOException {
msync(raf, bsAddress(), bs.capacity());
}
private static void msync(RandomAccessFile raf, long address, long length) throws IOException {
// address should be a multiple of page size
if (OS.pageAlign(address) != address) {