public bool Delete(string className) { //remove it from cache if needed if (m_name_cache.ContainsKey(className)) { ClassEntry t = (ClassEntry)m_name_cache[className]; t.BreakLinks(); m_name_cache.Remove(className); m_cid_cache.Remove(t.CId); } return(m_tree.Delete(new KCatalog(className))); }
/* Needed operations: * 1. Given an offset and length, set that range to be free space. * 2. Given an length, return the pair (offset, length) can be used. * that range will be removed from free space tree before this * operation returns. */ /// <summary> /// Set the segment in the databse file to be free. /// </summary> /// <param name="offset"></param> /// <param name="length"></param> public void SetSegmentFree(uint offset, int length) { if (offset + length != m_dbFile.Length) { uint nextSeg = (uint)(offset + length); KOffset target = new KOffset(nextSeg); KOffset finding = (KOffset)m_tree.Search(target); if (finding == null) { //combine to next segment is not possible, just go ahead to insert this one target.Offset = offset; target.Length = new DLength(length); if (m_tree.Insert(target) == false) { throw new OOD.Exception.ProgramLogicError( this, "Insert into free space b-tree failed."); } } else { //combine these two free segment into a big one length += finding.Length.Num; target.Length = new DLength(length); target.Offset = offset; if (m_tree.Delete(finding) == false || m_tree.Insert(target) == false) { throw new OOD.Exception.ProgramLogicError( this, "Delete free space failed."); } } } else { //this is the last segment in the database file, just remove it from the file m_dbFile.SetLength(offset); } }
public bool DeleteSegment(uint segId) { KSegId target = new KSegId(segId); return(m_tree.Delete(target)); }
public bool DeleteObject(object keyValue) { KClass target = new KClass(keyValue, OOD.Types.GetInternalType(keyValue.GetType())); return(m_tree.Delete(target)); }