1 package org.ozoneDB.core.storage; 8 9 import org.ozoneDB.core.Env; 10 import org.ozoneDB.core.Transaction; 11 import org.ozoneDB.core.Permissions; 12 13 import java.io.IOException ; 14 15 18 public abstract class AbstractClusterStore { 19 20 public final static String POSTFIX_SEPARATOR = "."; 21 public final static String POSTFIX_CLUSTER = ".cl"; 22 public final static String POSTFIX_LOCK = ".lk"; 23 public final static String POSTFIX_TEMP = ".tm"; 24 25 public transient long touchCount; 26 27 protected transient Env env; 28 29 public AbstractClusterStore(Env _env) { 30 this.env = _env; 31 } 32 33 public String basename(ClusterID cid) { 34 StringBuffer filename = new StringBuffer (env.getDatabaseDir()); 35 filename.append(Env.DATA_DIR); 36 filename.append(cid.value()); 38 return filename.toString(); 39 } 40 41 public abstract int currentBytesPerContainer(); 42 43 public abstract void registerContainerAndLock(StorageObjectContainer container, Permissions perms, Transaction locker, int lockLevel) throws Exception ; 44 45 protected abstract void activateCluster(Cluster cluster, int size); 46 47 protected abstract void deactivateCluster(Cluster cluster) throws IOException ; 48 49 protected abstract void prepareCommitCluster(Transaction ta, ClusterID cid) throws IOException , ClassNotFoundException ; 50 51 protected abstract void commitCluster(Transaction ta, ClusterID cid) throws IOException , ClassNotFoundException ; 52 53 protected abstract void abortCluster(Transaction ta, ClusterID cid) throws IOException , ClassNotFoundException ; 54 } 55 | Popular Tags |