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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checks free space listboolean
checks for double occurencesvoid
clear()
clear filevoid
close()
Close filevoid
create()
Create a file.void
delete()
delete fileelements()
iterator for the file elementsvoid
flush()
Flush filevoid
free
(long offset) Frees up space at offsetint
length
(long pos) length of file piece at posboolean
open()
Open an existing file.byte[]
read
(long offset) Reads data at offset from file and returns itint
readInt
(long position) read integer at positionvoid
begin transactionvoid
commit transactionvoid
rollback transactionlong
write
(byte[] data) write data into file.long
writeCompressed
(byte[] data, int originalLength) write compressed to file.long
writeDirect
(byte[] data) long
writeDirect
(long offset, int originallength, byte[] data)
-
Constructor Details
-
DataFileImp
-
-
Method Details
-
transactionBegin
Description copied from interface:DataFile
begin transaction- Specified by:
transactionBegin
in interfaceDataFile
- Throws:
IOException
-
transactionCommit
Description copied from interface:DataFile
commit transaction- Specified by:
transactionCommit
in interfaceDataFile
- Throws:
IOException
-
transactionRollback
Description copied from interface:DataFile
rollback transaction- Specified by:
transactionRollback
in interfaceDataFile
- Throws:
IOException
-
create
Create a file. If it exists it will be cleared. File has a header of 32 bytes- Specified by:
create
in interfaceDataFile
- Throws:
IOException
EDBException
-
open
Open an existing file. Return true if successful.- Specified by:
open
in interfaceDataFile
- Returns:
- Throws:
IOException
-
checkSanity1
public boolean checkSanity1()checks for double occurences- Specified by:
checkSanity1
in interfaceDataFile
- Returns:
-
checkSanity
public boolean checkSanity()checks free space list- Specified by:
checkSanity
in interfaceDataFile
- Returns:
-
writeDirect
- Throws:
IOException
-
writeDirect
- Throws:
IOException
-
read
Reads data at offset from file and returns it- Specified by:
read
in interfaceDataFile
- Parameters:
offset
-- Returns:
- Throws:
IOException
-
free
Frees up space at offset- Specified by:
free
in interfaceDataFile
- Parameters:
offset
-- Throws:
IOException
-
close
Close file- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceDataFile
- Throws:
IOException
-
flush
Flush file- Specified by:
flush
in interfaceDataFile
- Throws:
IOException
-
readInt
Description copied from interface:DataFile
read integer at position- Specified by:
readInt
in interfaceDataFile
- Returns:
- Throws:
IOException
-
write
write data into file. Returns address of data- Specified by:
write
in interfaceDataFile
- Parameters:
data
-- Returns:
- Throws:
IOException
-
writeCompressed
write compressed to file. Returns address of data- Specified by:
writeCompressed
in interfaceDataFile
- Parameters:
data
-originalLength
-- Returns:
- Throws:
IOException
-
delete
public void delete()delete file -
length
length of file piece at pos- Specified by:
length
in interfaceDataFile
- Parameters:
pos
-- Returns:
- Throws:
IOException
-
clear
clear file- Specified by:
clear
in interfaceDataFile
- Throws:
IOException
EDBException
-
elements
iterator for the file elements
-