@Override public void delete() throws IndexException { this.db.free(this.record, Database.POOL_STRING_SHORT); }
@Override public void delete() throws IndexException { this.db.free(this.record, Database.POOL_STRING_SHORT); }
/** * Deletes all properties stored in this object and the record associated with this object * itself. * <br><br> * <b>The behaviour of objects of this class after calling this method is undefined</b> * @throws IndexException */ public void delete() throws IndexException { clear(); this.db.free(this.record, Database.POOL_DB_PROPERTIES); }
/** * Deletes all properties stored in this object and the record associated with this object * itself. * <br><br> * <b>The behaviour of objects of this class after calling this method is undefined</b> * @throws IndexException */ public void delete() throws IndexException { clear(); this.db.free(this.record, Database.POOL_DB_PROPERTIES); }
@Override public void delete() throws IndexException { int length = this.db.getInt(this.record + LENGTH); final boolean useBytes = length < 0; int numChars1 = NUM_CHARS1; int numCharsn = NUM_CHARSN; if (useBytes) { length= -length; numChars1 *= 2; numCharsn *= 2; } long nextRecord = this.db.getRecPtr(this.record + NEXT1); this.db.free(this.record, Database.POOL_STRING_LONG); length -= numChars1; // Middle records. while (length > numCharsn) { length -= numCharsn; long nextnext = this.db.getRecPtr(nextRecord + NEXTN); this.db.free(nextRecord, Database.POOL_STRING_LONG); nextRecord = nextnext; } // Last record. this.db.free(nextRecord, Database.POOL_STRING_LONG); }
private void freePath() { long pathPointer = PATH.get(this.nd, this.address); this.nd.getDB().free(pathPointer, Database.POOL_MISC); } }
private void freePath() { long pathPointer = PATH.get(this.nd, this.address); this.nd.getDB().free(pathPointer, Database.POOL_MISC); } }
public void destruct() throws IndexException { Database db = getDB(); long current = this.address; while (true) { long ptr = db.getRecPtr(current + NEXT_MEMBER_BLOCK); db.free(current, Database.POOL_LINKED_LIST); if (isLastBlock(current, ptr)) { return; } current = ptr; } }
public void destruct() throws IndexException { Database db = getDB(); long current = this.address; while (true) { long ptr = db.getRecPtr(current + NEXT_MEMBER_BLOCK); db.free(current, Database.POOL_LINKED_LIST); if (isLastBlock(current, ptr)) { return; } current = ptr; } }
private void deallocateChildren(long record) { Chunk chunk = this.db.getChunk(record); // Copy all the children pointers to an array of longs so all the reads will happen on the same chunk // consecutively long[] children = new long[this.maxRecords + 1]; for (int idx = 0; idx < children.length; idx++) { children[idx] = getChild(chunk, record, idx); } this.db.free(record, Database.POOL_BTREE); chunk = null; for (long nextChild : children) { if (nextChild != 0) { deallocateChildren(nextChild); } } }
public void delete(long address) { if (address == 0) { return; } short nodeType = NdNode.NODE_TYPE.get(this, address); // Look up the type ITypeFactory<? extends NdNode> factory1 = getTypeFactory(nodeType); // Call its destructor factory1.destruct(this, address); // Free up its memory getDB().free(address, (short)(Database.POOL_FIRST_NODE_TYPE + nodeType)); // If this node was in the list of pending deletions, remove it since it's now been deleted if (this.pendingDeletions.containsKey(address)) { logDoubleDeletion(address); this.pendingDeletions.remove(address); } }
private void deallocateChildren(long record) { Chunk chunk = this.db.getChunk(record); // Copy all the children pointers to an array of longs so all the reads will happen on the same chunk // consecutively long[] children = new long[this.maxRecords + 1]; for (int idx = 0; idx < children.length; idx++) { children[idx] = getChild(chunk, record, idx); } this.db.free(record, Database.POOL_BTREE); chunk = null; for (long nextChild : children) { if (nextChild != 0) { deallocateChildren(nextChild); } } }
public void delete(long address) { if (address == 0) { return; } short nodeType = NdNode.NODE_TYPE.get(this, address); // Look up the type ITypeFactory<? extends NdNode> factory1 = getTypeFactory(nodeType); // Call its destructor factory1.destruct(this, address); // Free up its memory getDB().free(address, (short)(Database.POOL_FIRST_NODE_TYPE + nodeType)); // If this node was in the list of pending deletions, remove it since it's now been deleted if (this.pendingDeletions.containsKey(address)) { logDoubleDeletion(address); this.pendingDeletions.remove(address); } }
/** * Allocates a new normal block, copies the contents of the old block to it, and deletes the old block. Should not * be used if the array is using metablocks. Returns the address of the newly-allocated block. */ private long resizeBlock(Nd nd, long address, int newBlockSize) { Database db = nd.getDB(); long oldGrowableBlockAddress = GROWABLE_BLOCK_ADDRESS.get(nd, address); // Check if the existing block is already exactly the right size if (oldGrowableBlockAddress != 0) { if (newBlockSize == 0) { db.free(oldGrowableBlockAddress, Database.POOL_GROWABLE_ARRAY); return 0; } int oldAllocatedSize = GrowableBlockHeader.ALLOCATED_SIZE.get(nd, oldGrowableBlockAddress); if (oldAllocatedSize == newBlockSize) { return oldGrowableBlockAddress; } } int arraySize = size(nd, address); int numToCopySize = Math.min(Math.max(0, arraySize - this.inlineSize), newBlockSize); long newGrowableBlockAddress = db.malloc(computeBlockBytes(newBlockSize), Database.POOL_GROWABLE_ARRAY); if (oldGrowableBlockAddress != 0) { db.memcpy(newGrowableBlockAddress, oldGrowableBlockAddress, computeBlockBytes(numToCopySize)); db.free(oldGrowableBlockAddress, Database.POOL_GROWABLE_ARRAY); } GrowableBlockHeader.ARRAY_SIZE.put(nd, newGrowableBlockAddress, arraySize); GrowableBlockHeader.ALLOCATED_SIZE.put(nd, newGrowableBlockAddress, newBlockSize); return newGrowableBlockAddress; }
private void deleteIfUnreferenced(long address) { if (address == 0) { return; } short nodeType = NdNode.NODE_TYPE.get(this, address); // Look up the type ITypeFactory<? extends NdNode> factory1 = getTypeFactory(nodeType); if (factory1.isReadyForDeletion(this, address)) { // Call its destructor factory1.destruct(this, address); // Free up its memory getDB().free(address, (short)(Database.POOL_FIRST_NODE_TYPE + nodeType)); } }
public void delete() throws IndexException { this.db.getString(this.db.getRecPtr(this.record + KEY)).delete(); this.db.getString(this.db.getRecPtr(this.record + VALUE)).delete(); this.db.free(this.record, Database.POOL_DB_PROPERTIES); } }
private void deleteIfUnreferenced(long address) { if (address == 0) { return; } short nodeType = NdNode.NODE_TYPE.get(this, address); // Look up the type ITypeFactory<? extends NdNode> factory1 = getTypeFactory(nodeType); if (factory1.isReadyForDeletion(this, address)) { // Call its destructor factory1.destruct(this, address); // Free up its memory getDB().free(address, (short)(Database.POOL_FIRST_NODE_TYPE + nodeType)); } }
public void delete() throws IndexException { this.db.getString(this.db.getRecPtr(this.record + KEY)).delete(); this.db.getString(this.db.getRecPtr(this.record + VALUE)).delete(); this.db.free(this.record, Database.POOL_DB_PROPERTIES); } }
@Override public void destruct(Nd nd, long address) { Database db = nd.getDB(); db.getLog().start(this.destructTag); try { short poolId = getMemoryPoolId(nd); long headerStartAddress = address + this.offset; long firstBlockAddress = FIRST_BLOCK.get(nd, headerStartAddress); long nextBlockAddress = firstBlockAddress; while (nextBlockAddress != 0) { long currentBlockAddress = nextBlockAddress; nextBlockAddress = BlockHeader.NEXT_BLOCK.get(nd, currentBlockAddress); int elementsInBlock = BlockHeader.ELEMENTS_IN_USE.get(nd, currentBlockAddress); destructElements(nd, currentBlockAddress + BlockHeader.BLOCK_HEADER_BYTES, elementsInBlock); db.free(currentBlockAddress, poolId); } db.clearRange(headerStartAddress, getRecordSize()); } finally { db.getLog().end(this.destructTag); } }
@Override public void destruct(Nd nd, long address) { Database db = nd.getDB(); db.getLog().start(this.destructTag); try { short poolId = getMemoryPoolId(nd); long headerStartAddress = address + this.offset; long firstBlockAddress = FIRST_BLOCK.get(nd, headerStartAddress); long nextBlockAddress = firstBlockAddress; while (nextBlockAddress != 0) { long currentBlockAddress = nextBlockAddress; nextBlockAddress = BlockHeader.NEXT_BLOCK.get(nd, currentBlockAddress); int elementsInBlock = BlockHeader.ELEMENTS_IN_USE.get(nd, currentBlockAddress); destructElements(nd, currentBlockAddress + BlockHeader.BLOCK_HEADER_BYTES, elementsInBlock); db.free(currentBlockAddress, poolId); } db.clearRange(headerStartAddress, getRecordSize()); } finally { db.getLog().end(this.destructTag); } }