/** * A free Record Pointer is a pointer to a raw block, * i.e. the pointer is not moved past the BLOCK_HEADER_SIZE. */ public void putFreeRecPtr(final long offset, final long value) { makeDirty(); int idx = recPtrToIndex(offset); putInt(compressFreeRecPtr(value), this.fBuffer, idx); recordWrite(offset, 4); }
public long getFreeRecPtr(final long offset) { final int idx = recPtrToIndex(offset); int value = getInt(this.fBuffer, idx); return expandToFreeRecPtr(value); }
public void get(final long offset, byte[] data) { get(offset, data, 0, data.length); }
/** * A Record Pointer is a pointer as returned by Database.malloc(). * This is a pointer to a block + BLOCK_HEADER_SIZE. */ public static long getRecPtr(byte[] buffer, final int idx) { int value = Chunk.getInt(buffer, idx); long address = Chunk.expandToFreeRecPtr(value); return address != 0 ? (address + BLOCK_HEADER_SIZE) : address; }
/** * A Record Pointer is a pointer as returned by Database.malloc(). * This is a pointer to a block + BLOCK_HEADER_SIZE. */ public static void putRecPtr(final long value, byte[] buffer, int idx) { final int denseValue = value == 0 ? 0 : Chunk.compressFreeRecPtr(value - BLOCK_HEADER_SIZE); Chunk.putInt(denseValue, buffer, idx); }
} else { chunk = getChunk(freeBlock); chunk.makeDirty(); int blockReportedSize = chunk.getShort(freeBlock); if (blockReportedSize != useDeltas * BLOCK_SIZE_DELTA) { throw describeProblem() chunk.putShort(freeBlock, (short) -usedSize); chunk.clear(freeBlock + BLOCK_HEADER_SIZE, usedSize - BLOCK_HEADER_SIZE); result = freeBlock + BLOCK_HEADER_SIZE;
this.fHeaderChunk= new Chunk(this, 0); if (nChunksOnDisk <= 0) { this.fVersion= version; this.fChunksUsed = this.fChunks.length; } else { this.fHeaderChunk.read(); this.fVersion= this.fHeaderChunk.getInt(VERSION_OFFSET); this.fChunks = new Chunk[nChunksOnDisk]; // chunk[0] is unused. this.fChunksUsed = nChunksOnDisk;
this.fVersion= version; this.fHeaderChunk.clear(0, CHUNK_SIZE); this.fChunksUsed = this.fChunks.length; try { wasCanceled = this.fHeaderChunk.flush() || wasCanceled; // Zero out header chunk. wasCanceled = performUninterruptableWrite(() -> { this.fFile.getChannel().truncate(CHUNK_SIZE); this.fHeaderChunk.makeDirty(); return wasCanceled;
public void clearBytes(long offset, int byteCount) throws IndexException { getChunk(offset).clear(offset, byteCount); }
public char getChar(long offset) throws IndexException { return getChunk(offset).getChar(offset); }
public int get3ByteUnsignedInt(long offset) throws IndexException { return getChunk(offset).get3ByteUnsignedInt(offset); }
public byte getByte(long offset) throws IndexException { return getChunk(offset).getByte(offset); }
} else { chunk = getChunk(freeBlock); chunk.makeDirty(); int blockReportedSize = chunk.getShort(freeBlock); if (blockReportedSize != useDeltas * BLOCK_SIZE_DELTA) { throw describeProblem() chunk.putShort(freeBlock, (short) -usedSize); chunk.clear(freeBlock + BLOCK_HEADER_SIZE, usedSize - BLOCK_HEADER_SIZE); result = freeBlock + BLOCK_HEADER_SIZE;
this.fHeaderChunk= new Chunk(this, 0); if (nChunksOnDisk <= 0) { this.fVersion= version; this.fChunksUsed = this.fChunks.length; } else { this.fHeaderChunk.read(); this.fVersion= this.fHeaderChunk.getInt(VERSION_OFFSET); this.fChunks = new Chunk[nChunksOnDisk]; // chunk[0] is unused. this.fChunksUsed = nChunksOnDisk;
this.fVersion= version; this.fHeaderChunk.clear(0, CHUNK_SIZE); this.fChunksUsed = this.fChunks.length; try { wasCanceled = this.fHeaderChunk.flush() || wasCanceled; // Zero out header chunk. wasCanceled = performUninterruptableWrite(() -> { this.fFile.getChannel().truncate(CHUNK_SIZE); this.fHeaderChunk.makeDirty(); return wasCanceled;
/** * A Record Pointer is a pointer as returned by Database.malloc(). * This is a pointer to a block + BLOCK_HEADER_SIZE. */ public static long getRecPtr(byte[] buffer, final int idx) { int value = Chunk.getInt(buffer, idx); long address = Chunk.expandToFreeRecPtr(value); return address != 0 ? (address + BLOCK_HEADER_SIZE) : address; }