| java.lang.Object org.ozoneDB.core.wizardStore.ClusterStore
ClusterStore | final public class ClusterStore (Code) | | The ClusterStore is the back-end store of the wizardStore. It maintains the
cluster cache, activation/passivation and the actual persistent commits.
author: SMB author: Medium.net version: $Revision: 1.2 $Date: 2002/06/08 00:49:39 $ |
Method Summary | |
public synchronized void | abortCluster(Transaction ta, ClusterID cid) Actually abort the specified cluster. | protected void | activateCluster(Cluster cluster, int size) This method us called right after the specified Cluster was loaded from
disk. | protected String | basename(ClusterID cid) | public synchronized void | commitCluster(Transaction ta, ClusterID cid) Actually commit the specified cluster. | protected synchronized Cluster | createANewEmptyAndUsableCluster(Permissions perms) | protected int | currentBytesPerContainer() | public long | currentCacheSize() | protected void | deactivateCluster(Cluster cluster) Deactivate the specified cluster before it is written to disk. | protected Cluster | giveMeAnUnlockedCluster(Permissions perms) Returns or creates a cluster which is not locked so that locking it will succeed. | protected synchronized Cluster | growingCluster(Permissions perms) Parameters: perms - Permissions of the cluster to search. | public void | invalidateContainer(WizardObjectContainer container) | public boolean | isCleanShutdown() Check if the ClusterStore was cleanly shutted down. | public Cluster | loadCluster(ClusterID cid, boolean pin) Make sure the corresponding cluster is in the cache. | protected Object | loadData(String key) Load the data that previously has been stored for the given key. | public synchronized void | prepareCommitCluster(Transaction ta, ClusterID cid) Store the specified cluster on disk. | public DxSet | recoverClusterIDs() Search the DATA dir and recover all ClusterIDs. | public void | registerContainerAndPinAndLock(WizardObjectContainer container, Permissions perms, Transaction locker, int lockLevel) Associates the specified container with a cluster. | protected Cluster | restoreCluster(ClusterID cid) | public void | shutdown() | public void | splitCluster(Cluster cluster) | public void | startup() | protected void | storeData(Object obj, String key) Serialize and store the specified object for the specified key. | protected void | trimCache() Ensure that there is at least the specified size of free space in the
cluster cache. | public void | unloadCluster(ClusterID cid, boolean deactivate) Remove cluster from the cluster cache. | protected void | updateLockOnDisk(Cluster cluster, Transaction ta) |
POSTFIX_CLUSTER | final public static String POSTFIX_CLUSTER(Code) | | |
POSTFIX_SHADOW | final public static String POSTFIX_SHADOW(Code) | | |
compressionFactor | final protected static int compressionFactor(Code) | | |
growingClusterIDs | protected DxMap growingClusterIDs(Code) | | Table that maps Permissions to ClusterIDs.
|
maxClusterSize | protected int maxClusterSize(Code) | | |
touchCount | protected transient long touchCount(Code) | | |
activateCluster | protected void activateCluster(Cluster cluster, int size)(Code) | | This method us called right after the specified Cluster was loaded from
disk.
|
commitCluster | public synchronized void commitCluster(Transaction ta, ClusterID cid) throws IOException, ClassNotFoundException(Code) | | Actually commit the specified cluster. This simply renames the temp file
to be the new "original" ones. The rename operation MUST NOT fail.
Parameters: cid - Cluster to be commited. |
currentBytesPerContainer | protected int currentBytesPerContainer()(Code) | | |
currentCacheSize | public long currentCacheSize()(Code) | | |
deactivateCluster | protected void deactivateCluster(Cluster cluster) throws IOException(Code) | | Deactivate the specified cluster before it is written to disk. The
specified cluster will be removed from the cluster cache. If it currently
has shadows, they are written to disk. If any of the containers are
currently invoked (should normally never happen), the shadows must stay
in memory.
|
giveMeAnUnlockedCluster | protected Cluster giveMeAnUnlockedCluster(Permissions perms) throws IOException, ClassNotFoundException(Code) | | Returns or creates a cluster which is not locked so that locking it will succeed.
The returned cluster is only guaranteed to be not locked by any other thread as long as this
method is called during synchronization to this ClusterStore.
|
growingCluster | protected synchronized Cluster growingCluster(Permissions perms) throws Exception(Code) | | Parameters: perms - Permissions of the cluster to search. Cluster with the specified permissions that is good to store anew container in it. |
isCleanShutdown | public boolean isCleanShutdown()(Code) | | Check if the ClusterStore was cleanly shutted down.
|
loadCluster | public Cluster loadCluster(ClusterID cid, boolean pin) throws IOException, ClassNotFoundException(Code) | | Make sure the corresponding cluster is in the cache. While loading
clusters, we may have to throw away (and maybe store) some currently
cached clusters.
Parameters: cid - ClusterID of the cluster to load. Parameters: pin - wether the loaded cluster should be pinned as soon as it is loadedso that there may be no chance to unload unless it is unpinned.If this parameter is set to true, the user has to unpin the cluster.If this parameter is set to false, the cluster may already be unloaded when this method returns.after using it. |
prepareCommitCluster | public synchronized void prepareCommitCluster(Transaction ta, ClusterID cid) throws IOException, ClassNotFoundException(Code) | | Store the specified cluster on disk. Write temp files first. If this
write fails, the original are still valid. The cluster may has been
written to the disk already, if is was deactivated while transaction.
But in case the cluster (and its changes) are only in memory, we have to
write now to check if this is possible without errors.
Note: This only writes all currently commited transaction results to the
disk. This is different from the deactivation behaviour.
Parameters: cid - Cluster to be prepare-commited. exception: Exception - None of the clusters are written to disk. |
recoverClusterIDs | public DxSet recoverClusterIDs()(Code) | | Search the DATA dir and recover all ClusterIDs.
|
registerContainerAndPinAndLock | public void registerContainerAndPinAndLock(WizardObjectContainer container, Permissions perms, Transaction locker, int lockLevel) throws Exception(Code) | | Associates the specified container with a cluster.
Iff this method returns normally (without exception), the container is pinned and thus
has to be unpinned.
Iff this method returns normally (without exception), the container (and thus the cluster of the container)
is write locked
Parameters: container - Container to be registered with one cluster. |
shutdown | public void shutdown()(Code) | | |
storeData | protected void storeData(Object obj, String key) throws IOException(Code) | | Serialize and store the specified object for the specified key. This
current implementation uses the file system as back end store.
|
trimCache | protected void trimCache() throws IOException(Code) | | Ensure that there is at least the specified size of free space in the
cluster cache. Under some circumstances clusters (currently invoked)
cannot be deactivated. Therefore this method cannot guarantee that the
needed space is free afterwards.
This is the central method of the deactivation of containers that are
currently in use. This is different from the commit behaviour.
|
unloadCluster | public void unloadCluster(ClusterID cid, boolean deactivate) throws IOException(Code) | | Remove cluster from the cluster cache.
Parameters: cid - |
|
|