Changed copy on write to occur during lookup, rather than after lookup.

Much carnage, but it's way faster.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3172 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-06-21 13:07:42 +00:00
parent 8cb3db78e3
commit 1318a5204b
14 changed files with 134 additions and 280 deletions

View File

@@ -72,27 +72,6 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
}
}
/**
* Add a child to this directory, possibly doing a copy.
* @param name The name of the child.
* @param child The child node.
* @param lPath The lookup path to this directory.
* @return Success or failure.
*/
public boolean addChild(String name, AVMNode child, Lookup lPath)
{
// No, if a child with the given name exists. Note that uniqueness
// of names is built into the AVM, as opposed to being configurable.
if (getChild(name) != null)
{
return false;
}
DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath);
toModify.putChild(name, child);
child.setRepository(lPath.getRepository());
return true;
}
/**
* Does this directory directly contain the given node.
* @param node The node to check.
@@ -187,7 +166,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
* @param name The name of the child to remove.
*/
@SuppressWarnings("unchecked")
public void rawRemoveChild(String name)
public void removeChild(String name)
{
ChildEntry entry = getChild(name);
if (entry != null)
@@ -196,24 +175,6 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
}
}
/**
* Remove a child. Possibly copy.
* @param name The name of the child to remove.
* @param lPath The lookup path.
* @return Success or failure.
*/
public boolean removeChild(String name, Lookup lPath)
{
// Can't remove it if it's not there.
if (getChild(name) == null)
{
return false;
}
DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath);
toModify.rawRemoveChild(name);
return true;
}
/**
* Put a new child node into this directory. No copy.
* @param name The name of the child.
@@ -294,9 +255,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
*/
public void turnPrimary(Lookup lPath)
{
LayeredDirectoryNode toModify = (LayeredDirectoryNode)copyOnWrite(lPath);
Lookup lookup = SuperRepository.GetInstance().lookup(-1, lPath.getRepresentedPath());
toModify.rawSetPrimary(lookup.getCurrentIndirection());
assert false : "Should never happen.";
}
/**
@@ -306,8 +265,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
*/
public void retarget(Lookup lPath, String target)
{
LayeredDirectoryNode toModify = (LayeredDirectoryNode)copyOnWrite(lPath);
toModify.rawSetPrimary(target);
assert false : "Should never happen.";
}
/**