69 bool in_fragmented_record =
false;
72 uint64_t prospective_record_offset = 0;
81 uint64_t physical_record_offset =
95 switch (record_type) {
97 if (in_fragmented_record) {
102 if (scratch->empty()) {
103 in_fragmented_record =
false;
108 prospective_record_offset = physical_record_offset;
115 if (in_fragmented_record) {
120 if (scratch->empty()) {
121 in_fragmented_record =
false;
126 prospective_record_offset = physical_record_offset;
127 scratch->assign(fragment.data(), fragment.size());
128 in_fragmented_record =
true;
132 if (!in_fragmented_record) {
134 "missing start of fragmented record(1)");
136 scratch->append(fragment.data(), fragment.size());
141 if (!in_fragmented_record) {
143 "missing start of fragmented record(2)");
145 scratch->append(fragment.data(), fragment.size());
146 *record = Slice(*scratch);
153 if (in_fragmented_record) {
162 if (in_fragmented_record) {
164 in_fragmented_record =
false;
171 snprintf(buf,
sizeof(buf),
"unknown record type %u", record_type);
173 (fragment.size() + (in_fragmented_record ? scratch->size() : 0)),
175 in_fragmented_record =
false;
static const int kHeaderSize
uint64_t last_record_offset_
bool SkipToInitialBlock()
uint64_t end_of_buffer_offset_
unsigned int ReadPhysicalRecord(Slice *result)
uint64_t const initial_offset_
void ReportCorruption(uint64_t bytes, const char *reason)