|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.bsvrz.ars.ars.persistence.ContainerBackupIndex.ContainerBackupIndexImplementation
private static final class ContainerBackupIndex.ContainerBackupIndexImplementation
Eigentliche Implementierung des ContainerBackupIndex. wird von der ContainerBackupIndex
-Klasse gekapselt um einen sicheren Referenzzähler zu
ermöglichen. Zu den Zwecken der Threadsicherheit wird für jede ContainerBackupIndex-Datei maximal eine Instanz erzeugt und verwaltet. Jede Instanz kann von
mehreren ContainerBackupIndex-Objekten verwendet werden. Zu diesem Zweck implementiert diese Klasse einen Referenzzähler.
Nested Class Summary | |
---|---|
private static class |
ContainerBackupIndex.ContainerBackupIndexImplementation.IndexEntry
Hilfsklasse die einen einzelnen Dateneintrag speichert. |
Field Summary | |
---|---|
private File |
_file
|
private Object |
_fileLock
|
private static HashMap<File,ContainerBackupIndex.ContainerBackupIndexImplementation> |
_openFiles
Aus Synchronitätsgründen muss sichergestellt sein, dass wenn eine Indexdatei an zwei verschiedenen Stellen gleichzeitig angefragt wird, beide Threads das selbe Objekt erhalten. |
private int |
_referenceCount
Anzahl der Referenzen |
private static int |
CONTAINER_DELETED_FROM_INDEX
Markiert einen ungültigen Index-Eintrag. |
private static int |
CONTAINER_TO_SAVE
Legt fest, dass der Container im Index geschlossen ist und gesichert werden kann (z.B. |
private static int |
CURRENT_FILE_VERSION
|
private static int |
ENTRY_SIZE
|
private static int |
HEADER_MEDIUM_ID_SIZE
|
private static int |
HEADER_NUM_GAPS_SIZE
|
private static int |
HEADER_NUM_SORTED_ENTRIES_SIZE
|
private static int |
HEADER_POS_MEDIUM_ID
|
private static int |
HEADER_POS_NUM_GAPS
|
private static int |
HEADER_POS_NUM_SORTED_ENTRIES
|
private static int |
HEADER_SIZE
|
private static int |
HEADER_VERSION_SIZE
|
private static int |
SIZE_BYTE
|
private static int |
SIZE_INTEGER
|
private static int |
SIZE_LONG
|
Constructor Summary | |
---|---|
private |
ContainerBackupIndex.ContainerBackupIndexImplementation(File file)
|
Method Summary | |
---|---|
private void |
addReference()
|
void |
appendContainerID(long containerID)
Fügt einen Container hinzu |
static ContainerBackupIndex.ContainerBackupIndexImplementation |
createNewContainerBackupIndex(File path)
Erstellt eine neuen, leeren ContainerBackupIndexImplementation im angegebenen Verzeichnis. |
static boolean |
deleteContainerBackupIndex(File path)
Löscht einen ContainerBackupIndex aus dem angegeben Verzeichnis |
static ContainerBackupIndex.ContainerBackupIndexImplementation |
getContainerBackupIndex(File path)
Gibt eine ContainerBackupIndexImplementation aus einem angegebenen Verzeichnis zurück |
static ContainerBackupIndex.ContainerBackupIndexImplementation |
getContainerBackupIndex(String path)
Gibt eine ContainerBackupIndexImplementation aus einem angegebenen Verzeichnis zurück |
List<Long> |
getContainerIDs()
Gibt alle ContainerIDs im Index zurück |
private static ContainerBackupIndex.ContainerBackupIndexImplementation |
getInstance(File file)
Holt zu einer angegebenen Datei eine ContainerBackupIndexImplementation-Instanz. |
int |
getMaxMedienID()
|
boolean |
removeContainerID(long containerID,
int mediumID)
Entfernt eine ContainerID aus dem Index |
private boolean |
removeContainerIDFast(long containerID,
RandomAccessFile randomAccessFile,
int numOfSortedEntries,
int numOfGaps)
Markiert einen Container-Eintrag als ungültig |
private boolean |
removeContainerIDInSortedArea(long containerID,
RandomAccessFile randomAccessFile,
int numOfSortedEntries,
int numOfGaps)
Löscht einen Container-Eintrag aus dem sortierten Bereich |
private boolean |
removeContainerIDInUnsortedArea(long containerID,
RandomAccessFile randomAccessFile,
int numOfSortedEntries,
int numOfGaps)
Löscht einen Container-Eintrag aus dem unsortierten Bereich |
private boolean |
removeContainerIDWithRebuild(long containerIdToRemove,
RandomAccessFile randomAccessFile)
Löscht einen Container-Eintrag aus der Datei und sortiert dabei den kompletten Datenbereich neu |
private void |
removeReference()
|
private void |
reset()
Entfernt alle Daten aus der ContainerBackupIndexImplementation |
void |
setMaxMedienID(int mediumID)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int CURRENT_FILE_VERSION
private File _file
private final Object _fileLock
private static final int CONTAINER_TO_SAVE
private static final int CONTAINER_DELETED_FROM_INDEX
private static final HashMap<File,ContainerBackupIndex.ContainerBackupIndexImplementation> _openFiles
private int _referenceCount
private static final int SIZE_INTEGER
private static final int SIZE_BYTE
private static final int SIZE_LONG
private static final int HEADER_VERSION_SIZE
private static final int HEADER_MEDIUM_ID_SIZE
private static final int HEADER_NUM_SORTED_ENTRIES_SIZE
private static final int HEADER_NUM_GAPS_SIZE
private static final int HEADER_POS_MEDIUM_ID
private static final int HEADER_POS_NUM_SORTED_ENTRIES
private static final int HEADER_POS_NUM_GAPS
private static final int HEADER_SIZE
private static final int ENTRY_SIZE
Constructor Detail |
---|
private ContainerBackupIndex.ContainerBackupIndexImplementation(File file)
Method Detail |
---|
private void addReference()
private void removeReference()
public static ContainerBackupIndex.ContainerBackupIndexImplementation getContainerBackupIndex(File path)
path
- Verzeichnis
public static ContainerBackupIndex.ContainerBackupIndexImplementation getContainerBackupIndex(String path)
path
- Verzeichnis
private static ContainerBackupIndex.ContainerBackupIndexImplementation getInstance(File file)
file
- Datei
public static ContainerBackupIndex.ContainerBackupIndexImplementation createNewContainerBackupIndex(File path) throws IOException
path
- Verzeichnis
IOException
- IO-Fehlerpublic static boolean deleteContainerBackupIndex(File path)
path
- Verzeichnis
private void reset() throws IOException
IOException
- IO-Fehlerpublic void appendContainerID(long containerID) throws IOException
containerID
- Container-ID
IOException
- IO-Fehlerpublic boolean removeContainerID(long containerID, int mediumID) throws IOException
containerID
- ContainerID die zu entfernen ist.mediumID
- MediumID im Header, die evtl. erhöht werden muss
IOException
- IO-Fehlerpublic int getMaxMedienID() throws IOException
IOException
public void setMaxMedienID(int mediumID) throws IOException
IOException
private boolean removeContainerIDFast(long containerID, RandomAccessFile randomAccessFile, int numOfSortedEntries, int numOfGaps) throws IOException
containerID
- ContainerIDrandomAccessFile
- geöffnete DateinumOfSortedEntries
- Anzahl Sortierte EinträgenumOfGaps
- Anzahl ungültige Einträge
IOException
- IO-Fehlerprivate boolean removeContainerIDInSortedArea(long containerID, RandomAccessFile randomAccessFile, int numOfSortedEntries, int numOfGaps) throws IOException
containerID
- ContainerIDrandomAccessFile
- geöffnete DateinumOfSortedEntries
- Anzahl Sortierte EinträgenumOfGaps
- Anzahl ungültige Einträge
IOException
- IO-Fehlerprivate boolean removeContainerIDInUnsortedArea(long containerID, RandomAccessFile randomAccessFile, int numOfSortedEntries, int numOfGaps) throws IOException
containerID
- ContainerIDrandomAccessFile
- geöffnete DateinumOfSortedEntries
- Anzahl Sortierte EinträgenumOfGaps
- Anzahl ungültige Einträge
IOException
- IO-Fehlerprivate boolean removeContainerIDWithRebuild(long containerIdToRemove, RandomAccessFile randomAccessFile) throws IOException
containerIdToRemove
- ContainerIDrandomAccessFile
- geöffnete Datei
IOException
- IO-Fehlerpublic String toString()
toString
in class Object
public List<Long> getContainerIDs() throws IOException
IOException
- IO-Fehler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |