net.sf.joafip.heapfile.service
Interface IHeapDataManager

All Known Implementing Classes:
AbstractHeapDataManager, HeapFileCheckerDataManager, HeapFileDataManager, HeapMemoryDataManagerMock, HeapMultiFileDataManager

public interface IHeapDataManager

data management on heap file

Author:
luc peuvrier

Method Summary
 void backup(long identifier, int maxBackup)
           
 void checkIntegrity()
          check heap integrity
 void clearStandbyModification()
          clear creation, modification, and deletion to do on the heap
the heap remains unchanged
 java.util.Iterator<DataRecordIdentifier> dataRecordIterator()
           
 void deleteDataRecord(DataRecordIdentifier dataRecordIdentifier)
          delete an existing data record knowing its identifier
 void flush()
          flush creation, modification, and deletion to the heap
the heap is updated
write is disabled after flush
 long freeSize()
           
 java.lang.String getBackupFileName()
           
 java.lang.String getChangeFileName()
           
 java.util.Set<DataRecordIdentifier> getDataRecordIdentifierSet()
          for test purpose
 DataRecordIdentifier getNewDataRecordIdentifier()
          to get a new data identifier for data record creation
when created #readHeapDataRecord(DataRecordIdentifier) can be used for the data record identifier
 DataRecordIdentifier getNextFreeDataRecordIdentifier()
           
 int getNumberOfDataRecord()
           
 int getNumberOfFreeRecord()
           
 java.lang.String getStorageFileName()
           
 boolean haveDataRecord(DataRecordIdentifier dataRecordIdentifier)
          to check if have data record for a data record identifier
 long heapSize()
           
 boolean isDataLost()
           
 byte[] readDataRecord(DataRecordIdentifier dataRecordIdentifier)
          read data for a data record
 void setNextFreeDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier)
           
 void setWriteEnable(boolean writeEnable)
           
 void startService(boolean removeFiles)
          start heap data manager service.
 void stopService()
          stop heap data manager service, do not flush in file any modification.
 long usedSize()
           
 void writeDataRecord(DataRecordIdentifier dataRecordIdentifier, byte[] data)
          write data record
 

Method Detail

startService

void startService(boolean removeFiles)
                  throws HeapException
start heap data manager service.

Parameters:
removeFiles - true if remove files before open common initialization at construction
Throws:
HeapException - read/write error, file restored from stable backup, file management is not opened, no file in stable state

stopService

void stopService()
                 throws HeapException
stop heap data manager service, do not flush in file any modification. modification are lost

Throws:
HeapException

setWriteEnable

void setWriteEnable(boolean writeEnable)
                    throws HeapException
Throws:
HeapException

getNextFreeDataRecordIdentifier

DataRecordIdentifier getNextFreeDataRecordIdentifier()
                                                     throws HeapException
Throws:
HeapException

setNextFreeDataRecordIdentifier

void setNextFreeDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier)
                                     throws HeapException
Throws:
HeapException

getNewDataRecordIdentifier

DataRecordIdentifier getNewDataRecordIdentifier()
                                                throws HeapException
to get a new data identifier for data record creation
when created #readHeapDataRecord(DataRecordIdentifier) can be used for the data record identifier

Returns:
a new data record identifier
Throws:
HeapException

readDataRecord

byte[] readDataRecord(DataRecordIdentifier dataRecordIdentifier)
                      throws HeapException
read data for a data record

Parameters:
dataRecordIdentifier - data record to read identifier
Returns:
the data of the record, null if no data record for identifier
Throws:
HeapException

writeDataRecord

void writeDataRecord(DataRecordIdentifier dataRecordIdentifier,
                     byte[] data)
                     throws HeapException
write data record

Parameters:
dataRecordIdentifier - data record to write identifier
data - the data to write
Throws:
HeapException

deleteDataRecord

void deleteDataRecord(DataRecordIdentifier dataRecordIdentifier)
                      throws HeapException
delete an existing data record knowing its identifier

Parameters:
dataRecordIdentifier - data record to delete identifier
Throws:
HeapException

flush

void flush()
           throws HeapException
flush creation, modification, and deletion to the heap
the heap is updated
write is disabled after flush

Throws:
HeapException

clearStandbyModification

void clearStandbyModification()
                              throws HeapException
clear creation, modification, and deletion to do on the heap
the heap remains unchanged

Throws:
HeapException

getNumberOfDataRecord

int getNumberOfDataRecord()
                          throws HeapException
Returns:
number of data record in heap file
Throws:
HeapException

getNumberOfFreeRecord

int getNumberOfFreeRecord()
                          throws HeapException
Returns:
number of free record in heap file
Throws:
HeapException

heapSize

long heapSize()
              throws HeapException
Returns:
heap total size
Throws:
HeapException

freeSize

long freeSize()
              throws HeapException
Returns:
heap total free size
Throws:
HeapException

usedSize

long usedSize()
              throws HeapException
Returns:
heap total used size
Throws:
HeapException

isDataLost

boolean isDataLost()
Returns:
true if data lost after file stable state reconstruction

checkIntegrity

void checkIntegrity()
                    throws HeapException
check heap integrity

Throws:
HeapException - heap intgrity error

haveDataRecord

boolean haveDataRecord(DataRecordIdentifier dataRecordIdentifier)
                       throws HeapException
to check if have data record for a data record identifier

Parameters:
nodeIdentifier - the data record identifier
Returns:
true if have data record for a data record identifier
Throws:
HeapException

getDataRecordIdentifierSet

@Fortest
java.util.Set<DataRecordIdentifier> getDataRecordIdentifierSet()
                                                               throws HeapException
for test purpose

Returns:
all data record identifier
Throws:
HeapException

backup

void backup(long identifier,
            int maxBackup)
            throws HeapException
Throws:
HeapException

getStorageFileName

java.lang.String getStorageFileName()
                                    throws HeapException
Returns:
data storage file name
Throws:
HeapException

getBackupFileName

java.lang.String getBackupFileName()
                                   throws HeapException
Returns:
file name for backup logging
Throws:
HeapException

getChangeFileName

java.lang.String getChangeFileName()
                                   throws HeapException
Returns:
file name for change logging
Throws:
HeapException

dataRecordIterator

java.util.Iterator<DataRecordIdentifier> dataRecordIterator()


Copyright © 2007-2009 Luc Peuvrier. All Rights Reserved.