|
VRS
A file format for sensor data.
|
Listener to be notified when a new file chunk is finalized. More...
#include <NewChunkHandler.h>
Public Member Functions | |
| virtual void | newChunk (const string &path, size_t index, bool isLastChunk)=0 |
| virtual void | recordingFailed (MAYBE_UNUSED int error, MAYBE_UNUSED const std::vector< std::string > &unnotifiedChunks) |
Listener to be notified when a new file chunk is finalized.
Definition of a class of objects that can be attached to a RecordFileWriter, to monitor the creation of file chunks, to process them in some way (maybe to upload them in the cloud?).
|
pure virtual |
Callback function to be notified when new file chunks are created.
| index | the index of the chunk in the file, 0 being the first chunk. |
| path | local file path to the chunk. |
| isLastChunk | flag telling if the chunk is the file's last (last notification). Note that chunk notifications may come out of sequence, so do not rely on any ordering. However, when you get this notification, the chunk is complete and will never change, and you may even delete the chunk (maybe when upload streaming with limited disk space?). When isLastChunk set to true, the file is complete, and a notification for every of the file's chunks has been sent. These callbacks can happen from any thread context. |
|
inlinevirtual |
Callback function to be notified that the recording failed because writing records failed. It replaces the remaining newChunk() notifications: no notification follows it, and the file is incomplete. The writer closes the file's chunks and leaves them on disk, unless the write file handler's abort() discards the file, as AtomicDiskFile does, so that an interrupted live recording can be recovered. Handlers whose chunks are temporary, such as upload handlers, may delete them. Errors while writing the index or closing the file are reported by the writer, but they still end with the last newChunk() notification. It is called at most once, from any thread context.
| error | the error that stopped the recording. |
| unnotifiedChunks | paths of the chunks never passed to newChunk(): the chunk being written, and the head of split-head files. They may no longer exist if abort() discarded them. |