layout_streaming.h

constexpr uint32_t STREAMING_DEFAULT_CHUNK_SIZE = 2 * 1024 * 1024

Default Streaming Chunk Size. This is used in StreamingLayoutCW

class StreamingLayoutCW : public ouster::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 ts, const std::vector<uint8_t> &buf) override

Save a message to a specified stream.

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

  • ts[in] The timestamp for the messages.

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

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 uint32_t chunk_size() const override

Get the chunksize

Returns:

the chunk size

constexpr uint32_t STREAMING_DEFAULT_CHUNK_SIZE = 2 * 1024 * 1024

Default Streaming Chunk Size. This is used in StreamingLayoutCW