Class DataFileImp
java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.DataFileImp
- All Implemented Interfaces:
DataFile,Closeable,AutoCloseable
- Direct Known Subclasses:
BlockedDataFile
Manages file space for data like indice values, symbols etc.
File space is usable with variable lengths.
A free space list is managed. Data are compressed with lz4
File space is usable with variable lengths.
A free space list is managed. Data are compressed with lz4
- Author:
- angele
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanchecks free space listbooleanchecks for double occurencesvoidclear()clear filevoidclose()Close filevoidcreate()Create a file.voiddelete()delete fileelements()iterator for the file elementsvoidflush()Flush filevoidfree(long offset) Frees up space at offsetintlength(long pos) length of file piece at posbooleanopen()Open an existing file.byte[]read(long offset) Reads data at offset from file and returns itintreadInt(long position) read integer at positionvoidbegin transactionvoidcommit transactionvoidrollback transactionlongwrite(byte[] data) write data into file.longwriteCompressed(byte[] data, int originalLength) write compressed to file.longwriteDirect(byte[] data) longwriteDirect(long offset, int originallength, byte[] data)
-
Constructor Details
-
DataFileImp
-
-
Method Details
-
transactionBegin
Description copied from interface:DataFilebegin transaction- Specified by:
transactionBeginin interfaceDataFile- Throws:
IOException
-
transactionCommit
Description copied from interface:DataFilecommit transaction- Specified by:
transactionCommitin interfaceDataFile- Throws:
IOException
-
transactionRollback
Description copied from interface:DataFilerollback transaction- Specified by:
transactionRollbackin interfaceDataFile- Throws:
IOException
-
create
Create a file. If it exists it will be cleared. File has a header of 32 bytes- Specified by:
createin interfaceDataFile- Throws:
IOExceptionEDBException
-
open
Open an existing file. Return true if successful.- Specified by:
openin interfaceDataFile- Returns:
- Throws:
IOException
-
checkSanity1
public boolean checkSanity1()checks for double occurences- Specified by:
checkSanity1in interfaceDataFile- Returns:
-
checkSanity
public boolean checkSanity()checks free space list- Specified by:
checkSanityin interfaceDataFile- Returns:
-
writeDirect
- Throws:
IOException
-
writeDirect
- Throws:
IOException
-
read
Reads data at offset from file and returns it- Specified by:
readin interfaceDataFile- Parameters:
offset-- Returns:
- Throws:
IOException
-
free
Frees up space at offset- Specified by:
freein interfaceDataFile- Parameters:
offset-- Throws:
IOException
-
close
Close file- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDataFile- Throws:
IOException
-
flush
Flush file- Specified by:
flushin interfaceDataFile- Throws:
IOException
-
readInt
Description copied from interface:DataFileread integer at position- Specified by:
readIntin interfaceDataFile- Returns:
- Throws:
IOException
-
write
write data into file. Returns address of data- Specified by:
writein interfaceDataFile- Parameters:
data-- Returns:
- Throws:
IOException
-
writeCompressed
write compressed to file. Returns address of data- Specified by:
writeCompressedin interfaceDataFile- Parameters:
data-originalLength-- Returns:
- Throws:
IOException
-
delete
public void delete()delete file -
length
length of file piece at pos- Specified by:
lengthin interfaceDataFile- Parameters:
pos-- Returns:
- Throws:
IOException
-
clear
clear file- Specified by:
clearin interfaceDataFile- Throws:
IOExceptionEDBException
-
elements
iterator for the file elements
-