public void mapId(int id, Slot slot) { _slotTree.add(trans(), new IdSlotMapping(id, slot.address(), slot.length())); if (_commitFrequency > 0) { _slotInsertCount++; if (_commitFrequency == _slotInsertCount) { _slotTree.commit(trans()); _slotInsertCount = 0; } } }
public ByteArrayBuffer readBufferBySlot(Slot slot) { if (Slot.isNull(slot)) { return null; } if (DTrace.enabled) { DTrace.READ_SLOT.logLength(slot.address(), slot.length()); } ByteArrayBuffer buffer = new ByteArrayBuffer(slot.length()); buffer.readEncrypt(this, slot.address()); return buffer; }
public Slot allocateSlot(int length) { if (length <= 0) { throw new IllegalArgumentException(); } if (_freespaceManager != null && _freespaceManager.isStarted()) { Slot slot = _freespaceManager.allocateSlot(length); if (slot != null) { if (DTrace.enabled) { DTrace.GET_SLOT.logLength(slot.address(), slot.length()); } return slot; } while (growDatabaseByConfiguredSize()) { slot = _freespaceManager.allocateSlot(length); if (slot != null) { if (DTrace.enabled) { DTrace.GET_SLOT.logLength(slot.address(), slot.length()); } return slot; } } } Slot appendedSlot = appendBytes(length); if (DTrace.enabled) { DTrace.GET_SLOT.logLength(appendedSlot.address(), appendedSlot.length()); } return appendedSlot; }
public void writePointer(int id, Slot slot) { if (DTrace.enabled) { DTrace.WRITE_POINTER.log(id); DTrace.WRITE_POINTER.logLength(slot); } _pointerIo.seek(0); if (Deploy.debug) { _pointerIo.writeBegin(Const4.YAPPOINTER); } _pointerIo.writeInt(slot.address()); _pointerIo.writeInt(slot.length()); if (Deploy.debug) { _pointerIo.writeEnd(); } if (Debug4.xbytes) { _pointerIo.checkXBytes(false); } writeBytes(_pointerIo, id, 0); }
public void free(Slot slot) { if (slot.isNull()) { return; // TODO: This should really be an IllegalArgumentException but old database files // with index-based FreespaceManagers appear to deliver zeroed slots. // throw new IllegalArgumentException(); } if (_freespaceManager == null) { // Can happen on early free before freespacemanager // is up, during conversion. return; } if (DTrace.enabled) { DTrace.FILE_FREE.logLength(slot.address(), slot.length()); } _freespaceManager.free(slot); }
public StatefulBuffer readStatefulBufferBySlot(Transaction trans, int id, Slot slot) { if (Slot.isNull(slot)) { return null; } if (DTrace.enabled) { DTrace.READ_SLOT.logLength(slot.address(), slot.length()); } StatefulBuffer buffer = createStatefulBuffer(trans, slot.address(), slot.length()); buffer.setID(id); buffer.readEncrypt(this, slot.address()); return buffer; }
public void overwriteDeletedBlockedSlot(Slot slot) { overwriteDeletedBytes(slot.address(), _blockConverter.blocksToBytes(slot.length())); }