folly::recordio_helpers

Low-level helpers exposing the RecordIO record format.

Types

NameDescription
RecordInfo A record and the file id it was written with.

Functions

NameDescription
findRecord findRecord overloads
headerSize Header size.
prependHeader Write a header in the buffer. We will prepend the header to the front of the chain. Do not write the buffer if empty (we don't allow empty records). Returns the total length, including header (0 if empty) (same as buf->computeChainDataLength(), but likely faster)
validateRecord Check if there is a valid record at the beginning of range. This validates both record header and data and Returns the record data (not the header) if the record is valid, ByteRange() otherwise.
validateRecordData Check if there Record Data is valid (to be used after validating the header separately) Returns the record data (not the header) if the record data is valid, ByteRange() otherwise.
validateRecordHeader Check if the Record Header is valid at the beginning of range. Useful to check the validity of the header before building the entire record in IOBuf. If the record is from storage device (e.g. flash) then, it is better to make sure that the header is valid before reading the data from the storage device. Returns true if valid, false otherwise.