public class TransactionalRecordWriter extends Object implements RecordWriter
| Constructor and Description |
|---|
TransactionalRecordWriter(File recordLocation) |
| Modifier and Type | Method and Description |
|---|---|
void |
closeWriter()
This closes the writer channel and releases all the resources
|
void |
flush()
Guarantees the changes are flushed to the disk
|
long |
getDiskSize()
Gets the disk size of the persistence storage
|
Index |
getIndex() |
long |
getSize()
Gets the amount of data streams / records stored
|
boolean |
isOpen()
Checks if the writer is already open
|
void |
openWriter()
This opens the writer for all access, needs to be done before any operations are done on the recordwriter
|
RecordIterator |
readAllRecords()
This returns an iterator that can iterate over all persisted records.
|
RecordIterator |
readAllRecords(int limit)
This returns an iterator that can iterate over all persisted records to a defined limit.
|
RecordResult |
readRecord(UUIDKey documentId)
This reads a specific record at the indicated record position
|
void |
removeRecord(UUIDKey documentId)
This will command the writer to remove the indicated record from storage.
|
void |
updateRecord(UUIDKey documentId,
ClonableDataStream dataStream)
This updates the record contents stored in storage for a given updated content and the current
record pointer to the record.
|
void |
verify(java.util.function.Function<RecordResult,UUIDKey> f) |
void |
writeRecord(UUIDKey documentId,
ClonableDataStream dataStream)
This writes the given content to the filesystem and returns the record pointer at which the record
can be retrieved on next attempt.
|
public TransactionalRecordWriter(File recordLocation)
public void openWriter()
throws JasDBStorageException
RecordWriteropenWriter in interface RecordWriterJasDBStorageException - If unable to open the writerpublic void closeWriter()
throws JasDBStorageException
RecordWritercloseWriter in interface RecordWriterJasDBStorageException - If unable to close the writerpublic void flush()
throws JasDBStorageException
RecordWriterflush in interface RecordWriterJasDBStorageException - If unable to flush changes to the diskpublic boolean isOpen()
RecordWriterisOpen in interface RecordWriterpublic long getDiskSize()
throws JasDBStorageException
RecordWritergetDiskSize in interface RecordWriterJasDBStorageException - If unable to get the disksizepublic long getSize()
RecordWritergetSize in interface RecordWriterpublic RecordIterator readAllRecords() throws DatastoreException
RecordWriterreadAllRecords in interface RecordWriterDatastoreExceptionpublic RecordIterator readAllRecords(int limit) throws DatastoreException
RecordWriterreadAllRecords in interface RecordWriterDatastoreExceptionpublic RecordResult readRecord(UUIDKey documentId) throws JasDBStorageException
RecordWriterreadRecord in interface RecordWriterdocumentId - The document key identifier used to identify the document to write to storageJasDBStorageException - In case the record could not be found or readpublic void writeRecord(UUIDKey documentId, ClonableDataStream dataStream) throws JasDBStorageException
RecordWriterwriteRecord in interface RecordWriterdocumentId - The document key identifier used to identify the document to write to storagedataStream - The datastream to be written to storageJasDBStorageException - If unable to write the record to the storagepublic void removeRecord(UUIDKey documentId) throws JasDBStorageException
RecordWriterremoveRecord in interface RecordWriterdocumentId - The document key identifier used to identify the document to removeJasDBStorageException - If unable to find the indicated record or removing failed.public void updateRecord(UUIDKey documentId, ClonableDataStream dataStream) throws JasDBStorageException
RecordWriterupdateRecord in interface RecordWriterdocumentId - The document key identifier used to identify the document to write to storagedataStream - The datastream to be written to storageJasDBStorageException - If unable to update in case no record exists or unable to update in storage.public Index getIndex()
public void verify(java.util.function.Function<RecordResult,UUIDKey> f)
Copyright © 2015. All rights reserved.