VRS
A file format for sensor data.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
vrs::NewChunkHandler Class Referenceabstract

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)
 

Detailed Description

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?).

Member Function Documentation

◆ newChunk()

virtual void vrs::NewChunkHandler::newChunk ( const string &  path,
size_t  index,
bool  isLastChunk 
)
pure virtual

Callback function to be notified when new file chunks are created.

Parameters
indexthe index of the chunk in the file, 0 being the first chunk.
pathlocal file path to the chunk.
isLastChunkflag 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.

◆ recordingFailed()

virtual void vrs::NewChunkHandler::recordingFailed ( MAYBE_UNUSED int  error,
MAYBE_UNUSED const std::vector< std::string > &  unnotifiedChunks 
)
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.

Parameters
errorthe error that stopped the recording.
unnotifiedChunkspaths 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.

The documentation for this class was generated from the following file: