public interface RecordWriter
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
|
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 |
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.
|
long getDiskSize() throws JasDBStorageException
JasDBStorageException
- If unable to get the disksizelong getSize() throws JasDBStorageException
JasDBStorageException
- If unable to get the sizevoid openWriter() throws JasDBStorageException
JasDBStorageException
- If unable to open the writervoid closeWriter() throws JasDBStorageException
JasDBStorageException
- If unable to close the writervoid flush() throws JasDBStorageException
JasDBStorageException
- If unable to flush changes to the diskboolean isOpen()
RecordIterator readAllRecords() throws JasDBStorageException
JasDBStorageException
- If unable to return an iterator, channel is closed or not accessibleRecordIterator readAllRecords(int limit) throws JasDBStorageException
JasDBStorageException
- If unable to return an iterator, channel is closed or not accessibleRecordResult readRecord(UUIDKey documentId) throws JasDBStorageException
documentId
- The document key identifier used to identify the document to write to storageJasDBStorageException
- In case the record could not be found or readvoid writeRecord(UUIDKey documentId, ClonableDataStream dataStream) throws JasDBStorageException
documentId
- 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 storagevoid removeRecord(UUIDKey documentId) throws JasDBStorageException
documentId
- The document key identifier used to identify the document to removeJasDBStorageException
- If unable to find the indicated record or removing failed.void updateRecord(UUIDKey documentId, ClonableDataStream dataStream) throws JasDBStorageException
documentId
- 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.Copyright © 2015. All rights reserved.