Byte cleaner
This commit is contained in:
parent
7321795000
commit
bf40dd7787
@ -21,7 +21,7 @@ public class DatabaseReferencesMetadata implements IReferencesMetadata {
|
|||||||
public static final byte ERRORED_CLEANER = (byte) -1;
|
public static final byte ERRORED_CLEANER = (byte) -1;
|
||||||
public static final byte BLANK_DATA_CLEANER = (byte) -2;
|
public static final byte BLANK_DATA_CLEANER = (byte) -2;
|
||||||
public static final ReferenceInfo NONEXISTENT_REFERENCE_INFO = new ReferenceInfo(ERRORED_CLEANER, ERROR_BLOCK_ID);
|
public static final ReferenceInfo NONEXISTENT_REFERENCE_INFO = new ReferenceInfo(ERRORED_CLEANER, ERROR_BLOCK_ID);
|
||||||
private static final int REF_META_BYTES_COUNT = Long.BYTES + Integer.BYTES;
|
private static final int REF_META_BYTES_COUNT = Long.BYTES + Byte.BYTES;
|
||||||
public static final int REF_META_READS_AT_EVERY_READ = (DISK_BLOCK_SIZE - DISK_BLOCK_SIZE % REF_META_BYTES_COUNT) / REF_META_BYTES_COUNT;
|
public static final int REF_META_READS_AT_EVERY_READ = (DISK_BLOCK_SIZE - DISK_BLOCK_SIZE % REF_META_BYTES_COUNT) / REF_META_BYTES_COUNT;
|
||||||
|
|
||||||
private final AsynchronousFileChannel metaFileChannel;
|
private final AsynchronousFileChannel metaFileChannel;
|
||||||
@ -91,7 +91,7 @@ public class DatabaseReferencesMetadata implements IReferencesMetadata {
|
|||||||
for (int delta = 0; delta < referencesCount; delta++) {
|
for (int delta = 0; delta < referencesCount; delta++) {
|
||||||
long referenceToLoad = reference + delta;
|
long referenceToLoad = reference + delta;
|
||||||
long currentBlock = buffer.getLong();
|
long currentBlock = buffer.getLong();
|
||||||
byte cleanerId = (byte) buffer.getInt();
|
byte cleanerId = buffer.get();
|
||||||
if (buffer.limit() != 0 && currentBlock != 0xFFFFFFFFFFFFFFFFL) {
|
if (buffer.limit() != 0 && currentBlock != 0xFFFFFFFFFFFFFFFFL) {
|
||||||
allReferences[delta] = referenceToLoad;
|
allReferences[delta] = referenceToLoad;
|
||||||
allCleaners[delta] = cleanerId;
|
allCleaners[delta] = cleanerId;
|
||||||
@ -191,7 +191,7 @@ public class DatabaseReferencesMetadata implements IReferencesMetadata {
|
|||||||
}
|
}
|
||||||
ByteBuffer data = ByteBuffer.allocate(REF_META_BYTES_COUNT);
|
ByteBuffer data = ByteBuffer.allocate(REF_META_BYTES_COUNT);
|
||||||
data.putLong(blockId);
|
data.putLong(blockId);
|
||||||
data.putInt(cleanerId & 0xFF);
|
data.put(cleanerId);
|
||||||
data.flip();
|
data.flip();
|
||||||
try {
|
try {
|
||||||
metaFileChannel.write(data, reference * REF_META_BYTES_COUNT).get();
|
metaFileChannel.write(data, reference * REF_META_BYTES_COUNT).get();
|
||||||
|
Loading…
Reference in New Issue
Block a user