|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.faunos.skwish.sys.mgr.UnitDir
public class UnitDir
A directory on the file system containing a unit of work data. The work data
may include an [offset] index file, an entry [contents] file (which together
make a BaseSegment), and a deleted ID file.
FileConventions| Nested Class Summary | |
|---|---|
class |
UnitDir.Seg
A BaseSegment backed with files in the enclosing
instance's directory. |
| Constructor Summary | |
|---|---|
UnitDir(File dir)
|
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
Equality semantics are based on the directory location of the instance. |
File |
getDeleteSetFile()
Returns the detete-set file. |
File |
getDir()
Returns the directory this unit lives in. |
File |
getEntryFile()
Returns the entry file. |
File |
getIndexFile()
Returns the index file. |
String |
getName()
Returns the name of the directory this unit lives in. |
int |
getUnitNumber()
|
int |
getUsageCount()
Returns the usage count. |
boolean |
hasDeleteSet()
Determines whether the delete-set file exists. |
int |
hashCode()
Returns a suitable hash code as per the general contract of
java.lang.Object. |
boolean |
hasSegment()
Determines whether the instance has a segment. |
static void |
initInstance(File committedDir)
Creates an initial empty segment in the given "committed" directory. |
boolean |
isPurgeable()
Determines whether this unit is purgeable. |
boolean |
isPurged()
Determines whether this unit has been purged. |
boolean |
isSegmentPurged()
Determines whether the segment files have been purged (deleted). |
FileBackedDeleteSet |
loadDeleteSet()
Loads the delete-set in this unit, if any, and returns it in read-write mode; returns null if there is no delete-set file. |
FileBackedDeleteSet |
loadDeleteSet(boolean readOnly)
Loads the delete-set in this unit, if any, and returns it in the specified read/write mode; returns null if there is no
delete-set file. |
UnitDir.Seg |
loadSegment()
Loads and returns an existing BaseSegment from this
directory, if it exists; or null, if not found. |
boolean |
purge()
Purges (deletes) this entire unit directory provided it is purgeable. |
void |
purgeDeleteSet()
Purges (deletes) the delete-set file. |
void |
purgeSegment()
Purges (deletes) the segment files in the correct order. |
String |
toString()
|
static UnitDir |
writeNewInstance(File parentDir,
int unitNumber)
Creates and returns a new unit in the given parent directory. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UnitDir(File dir)
| Method Detail |
|---|
public File getDir()
public String getName()
public int getUsageCount()
public File getIndexFile()
FileConventions.INDEX_FILEpublic File getEntryFile()
FileConventions.ENTRY_FILEpublic File getDeleteSetFile()
FileConventions.DELETE_SET_FILEpublic void purgeSegment()
public boolean isSegmentPurged()
public boolean hasSegment()
public void purgeDeleteSet()
public boolean hasDeleteSet()
public boolean isPurgeable()
public boolean purge()
true, if and only if this instance was
purgeable, and has not been already
purgedpublic boolean isPurged()
public UnitDir.Seg loadSegment()
throws IOException
BaseSegment from this
directory, if it exists; or null, if not found.
IOException
public FileBackedDeleteSet loadDeleteSet()
throws IOException
null if there is no delete-set file.
IOException
public FileBackedDeleteSet loadDeleteSet(boolean readOnly)
throws IOException
null if there is no
delete-set file.
readOnly - true, if the delete-set is to be returned in
read-only mode; false, if to be returned in
read-write mode.
IOExceptionpublic boolean equals(Object obj)
equals in class Objecttrue, if and only if the other object is an
instance of this class and its directory
is the same as this one.public int hashCode()
java.lang.Object.
hashCode in class Objectequals(Object)public String toString()
toString in class Object
public static UnitDir writeNewInstance(File parentDir,
int unitNumber)
throws IOException
parentDir - the parent directory in which the instance will be created;
must be an existing directoryunitNumber - the unit number associated with numbered naming convention for
unit directories
IOExceptionFileConventions.toUnitDirname(int)
public static void initInstance(File committedDir)
throws IOException
IOExceptionpublic int getUnitNumber()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||