|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectDbStorage.DbStorageManager
This class works as a intermedite between the high level database data structures and, the Storage and LOG modules. The database storage is compound of 5 segments: dictionary segment, id segment, content segment and LOB segment . This class synchonizes its methods to ensure that the basic I/O database operatios will be athomic.
Field Summary | |
static int |
CONTENT_SEGMENT
The number of the content segment. |
static int |
CONTENT_SEGMENT_UNIT_SIZE
The size of the units in the content segment |
static int |
DICTIONARY_SEGMENT
The number of the dictionary segment. |
static int |
DICTIONARY_SEGMENT_UNIT_SIZE
The size of the units in the dictionary segment |
static int |
ID_SEGMENT
The number of the id segment. |
static int |
ID_SEGMENT_UNIT_SIZE
The size of the units in the id segment |
static int |
LOB_SEGMENT
The number of the LOB segment. |
int |
LOB_SEGMENT_UNIT_SIZE
The size of the units in the LOB segment |
static int |
PARENTS_SEGMENT
The number of the parents' segment. |
static int |
PARENTS_SEGMENT_UNIT_SIZE
The size of the units in the parents' segment |
Constructor Summary | |
DbStorageManager(storage.primitiveStorage.PrimitiveStorageManager psm)
Creates a new database storage manager. |
Method Summary | |
void |
addSpecifiedUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress)
Adds (Occups) a specified unit in the segment. |
void |
addUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress newUnitAddress)
Adds (Occups) a new unit in the segment. |
void |
addUnitAsCloserAsPosibleOf(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
DbUnitAddress newUnitAddress)
Tries to add (Occup) a new unit first in the same page, second in the same space and finally in the same segment of a specified unit. |
void |
createDefaultSettings(java.io.File dbDirectory)
Creates a default storage organization for a database. |
void |
dropUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress)
Drops (Frees) the specified unit. |
storage.advancedStorage.AdvancedStorageManager |
getAdvancedStorageManager()
Returns the underlying advanced storage manager. |
storage.intermediateStorage.IntermediateStorageManager |
getIntermediateStorageManager()
Returns the underlying intermediate storage manager. |
int |
getLobSegmentUnitSize()
Returns the unit size of LOB segment. |
int |
getPageSize()
Returns the used page size. |
int |
getParentsSegmentUnitSize()
Returns the unit size of Parents' segment. |
storage.primitiveStorage.PrimitiveStorageManager |
getPrimitiveStorageManager()
Returns the underlying primitive storage manager. |
storage.tools.StorageToolsManager |
getStorageToolsManager()
Returns the underlying storage tools' manager. |
storage.UnitsStorageManager |
getUnitsStorageManager()
Returns the underlying units' storage manager. |
boolean |
isFreeUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress)
Checks if a unit is free. |
boolean |
isOccupiedUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress)
Checks if a unit is occupied. |
byte |
readByte(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset)
Reads a byte inside a unit. |
char |
readChar(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset)
Reads a char inside a unit. |
void |
readDbUnitAddress(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
DbUnitAddress newUnitAddress)
Reads a DbUnitAddress inside a unit. |
double |
readDouble(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset)
Reads a double inside a unit. |
int |
readInt(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset)
Reads a int inside a unit. |
long |
readLong(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset)
Reads a long inside a unit. |
void |
readUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
byte[] b,
int off)
Reads fully a unit. |
void |
readUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
int length,
byte[] b,
int off)
Reads partially a unit starting from an offset and reading a specific length. |
void |
writeByte(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
byte b)
Writes a byte into a unit starting from an offset. |
void |
writeChar(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
char c)
Writes a char into a unit starting from an offset. |
void |
writeDbUnitAddress(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
DbUnitAddress newUnitAddress)
Writes a DbUnitAddress into a unit starting from an offset. |
void |
writeDouble(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
double d)
Writes a double into a unit starting from an offset. |
void |
writeInt(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
int i)
Writes a int into a unit starting from an offset. |
void |
writeLong(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
long l)
Writes a long into a unit starting from an offset. |
void |
writeUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
byte[] b,
int off)
Writes fully a unit. |
void |
writeUnit(long transactionNumber,
int segmentNumber,
DbUnitAddress unitAddress,
int unitOffset,
int length,
byte[] b,
int off)
Writes partially a unit starting from an offset and writing a specific length of bytes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ID_SEGMENT
public static final int CONTENT_SEGMENT
public static final int LOB_SEGMENT
public static final int PARENTS_SEGMENT
public static final int DICTIONARY_SEGMENT
public static final int ID_SEGMENT_UNIT_SIZE
public static final int CONTENT_SEGMENT_UNIT_SIZE
public int LOB_SEGMENT_UNIT_SIZE
public static final int PARENTS_SEGMENT_UNIT_SIZE
public static final int DICTIONARY_SEGMENT_UNIT_SIZE
Constructor Detail |
public DbStorageManager(storage.primitiveStorage.PrimitiveStorageManager psm) throws TooSmallPageSizeException
Method Detail |
public void addUnit(long transactionNumber, int segmentNumber, DbUnitAddress newUnitAddress) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.newUnitAddress
- Where the address of the new unit will be stored.
storage.StorageException
java.io.IOException
public void addUnitAsCloserAsPosibleOf(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, DbUnitAddress newUnitAddress) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment of the close unit.unitAddress
- The address of the close unit in the segment.newUnitAddress
- Where the address of the new unit will be stored.
storage.StorageException
java.io.IOException
public void addSpecifiedUnit(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit to ocup.
storage.StorageException
java.io.IOException
public void dropUnit(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.
storage.StorageException
java.io.IOException
public void readUnit(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, byte[] b, int off) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.b
- The byte array which the content of the readed unit will be stored.off
- The offset of b
from which the readed content will be stored.
storage.StorageException
java.io.IOException
public void readUnit(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, int length, byte[] b, int off) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the unit from which the reading starts.length
- The number of bytes to be readed.b
- The byte array which the content of the readed unit will be stored.off
- The offset of b
from which the readed content will be stored.
storage.StorageException
java.io.IOException
public void writeUnit(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, byte[] b, int off) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.b
- The byte array from which the units's content will be get.off
- The offset of b
from which the unit's content will be get.
storage.StorageException
java.io.IOException
public void writeUnit(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, int length, byte[] b, int off) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the unit from which the writing starts.length
- The number of bytes to be wrote.b
- The byte array from which the units's content will be get.off
- The offset of b
from which the unit's content will be get.
storage.StorageException
java.io.IOException
public boolean isFreeUnit(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.
true
if the specified unit is free, false
otherwise.
storage.StorageException
java.io.IOException
public boolean isOccupiedUnit(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress) throws storage.StorageException, java.io.IOException
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.
true
if the specified unit is occupied, false
otherwise.
storage.StorageException
java.io.IOException
public byte readByte(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset) throws storage.StorageException, java.io.IOException
byte
inside a unit.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the byte
in the unit.
byte
in the specified page's position.
storage.StorageException
java.io.IOException
public char readChar(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset) throws storage.StorageException, java.io.IOException
char
inside a unit.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the char
in the unit.
char
in the specified page's position.
storage.StorageException
java.io.IOException
public int readInt(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset) throws storage.StorageException, java.io.IOException
int
inside a unit.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the int
in the unit.
int
in the specified page's position.
storage.StorageException
java.io.IOException
public long readLong(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset) throws storage.StorageException, java.io.IOException
long
inside a unit.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the long
in the unit.
long
in the specified page's position.
storage.StorageException
java.io.IOException
public double readDouble(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset) throws storage.StorageException, java.io.IOException
double
inside a unit.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the double
in the unit.
double
in the specified page's position.
storage.StorageException
java.io.IOException
public void readDbUnitAddress(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, DbUnitAddress newUnitAddress) throws storage.StorageException, java.io.IOException
DbUnitAddress
inside a unit.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the DbUnitAddress
in the unit.newUnitAddress
- The DbUnitAddress
in the specified page's position.
storage.StorageException
java.io.IOException
public void writeByte(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, byte b) throws storage.StorageException, java.io.IOException
byte
into a unit starting from an offset.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the unit from which the writing starts.b
- The byte
to be wrote.
storage.StorageException
java.io.IOException
public void writeChar(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, char c) throws storage.StorageException, java.io.IOException
char
into a unit starting from an offset.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the unit from which the writing starts.c
- The char
to be wrote.
storage.StorageException
java.io.IOException
public void writeInt(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, int i) throws storage.StorageException, java.io.IOException
int
into a unit starting from an offset.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the unit from which the writing starts.i
- The int
to be wrote.
storage.StorageException
java.io.IOException
public void writeLong(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, long l) throws storage.StorageException, java.io.IOException
long
into a unit starting from an offset.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the unit from which the writing starts.l
- The long
to be wrote.
storage.StorageException
java.io.IOException
public void writeDouble(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, double d) throws storage.StorageException, java.io.IOException
double
into a unit starting from an offset.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the unit from which the writing starts.d
- The double
to be written.
storage.StorageException
java.io.IOException
public void writeDbUnitAddress(long transactionNumber, int segmentNumber, DbUnitAddress unitAddress, int unitOffset, DbUnitAddress newUnitAddress) throws storage.StorageException, java.io.IOException
DbUnitAddress
into a unit starting from an offset.
transactionNumber
- The number of transaction.segmentNumber
- The number of the segment.unitAddress
- The address of the unit in the segment.unitOffset
- The position of the unit from which the writing starts.newUnitAddress
- The DbUnitAddress
to be wrote.
storage.StorageException
java.io.IOException
public void createDefaultSettings(java.io.File dbDirectory) throws storage.primitiveStorage.PrimitiveStorageException, storage.intermediateStorage.IntermediateStorageException, storage.advancedStorage.AdvancedStorageException, java.io.IOException
storage.primitiveStorage.PrimitiveStorageException
storage.intermediateStorage.IntermediateStorageException
storage.advancedStorage.AdvancedStorageException
java.io.IOException
public storage.advancedStorage.AdvancedStorageManager getAdvancedStorageManager()
public storage.intermediateStorage.IntermediateStorageManager getIntermediateStorageManager()
public storage.primitiveStorage.PrimitiveStorageManager getPrimitiveStorageManager()
public storage.UnitsStorageManager getUnitsStorageManager()
public storage.tools.StorageToolsManager getStorageToolsManager()
public int getLobSegmentUnitSize()
public int getParentsSegmentUnitSize()
public int getPageSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |