Class StreamingLayoutCW

Inheritance Relationships

Base Type

Class Documentation

class StreamingLayoutCW : public ouster::sdk::osf::ChunksWriter

Sreaming Layout chunking strategy.

TODO[pb]: sorting TBD as in RFC0018 but first pass should be good enough because usually messages from the same source and of the same type comes sorted from pcap/bag sources.

When messages laid out into chunks in an ordered as they come (not full RFC0018 compliant, see TODO below), with every chunk holding messages exclusively of a single stream_id. Tries not to exceede chunk_size (if possible). However if a single message size is bigger than specified chunk_size it’s still recorded.

Public Functions

StreamingLayoutCW(Writer &writer, uint32_t chunk_size = STREAMING_DEFAULT_CHUNK_SIZE)
Parameters:
  • writer[in]Writer object for use when writing messages

  • chunk_size[in] – The chunk size to use, this arg is optional.

virtual void save_message(const uint32_t stream_id, const ts_t receive_ts, const ts_t sensor_ts, const std::vector<uint8_t> &buf, const std::string &type) override

Save a message to a specified stream.

Parameters:
  • stream_id[in] – The stream id to associate with the message.

  • receive_ts[in] – The receive timestamp for the messages.

  • sensor_ts[in] – The sensor timestamp for the messages.

  • buf[in] – A vector of message buffers to record.

  • type[in] – Message type string of the message being saved.

Throws:

std::logic_error – Exception on inconsistent timestamps.

virtual void finish() override

Finish the process of saving messages and write out the stream stats.

virtual void flush(uint32_t stream_id) override

Flush the latest chunk on this stream to disk.

Parameters:

stream_id[in] – id of the stream to flush

virtual uint32_t chunk_size() const override

Get the chunksize.

Returns:

the chunk size

const StreamStats &get_stats(uint32_t stream_id) const

Get stats for a specific stream;.

Parameters:

stream_id[in] – stream id

Returns:

StreamStats of selected stream_id