MCPcopy Create free account
hub / github.com/ElementsProject/elements / PrintLogContents

Function PrintLogContents

src/leveldb/db/dumpfile.cc:54–72  ·  view source on GitHub ↗

Print contents of a log file. (*func)() is called on every record.

Source from the content-addressed store, hash-verified

52
53// Print contents of a log file. (*func)() is called on every record.
54Status PrintLogContents(Env* env, const std::string& fname,
55 void (*func)(uint64_t, Slice, WritableFile*),
56 WritableFile* dst) {
57 SequentialFile* file;
58 Status s = env->NewSequentialFile(fname, &file);
59 if (!s.ok()) {
60 return s;
61 }
62 CorruptionReporter reporter;
63 reporter.dst_ = dst;
64 log::Reader reader(file, &reporter, true, 0);
65 Slice record;
66 std::string scratch;
67 while (reader.ReadRecord(&record, &scratch)) {
68 (*func)(reader.LastRecordOffset(), record, dst);
69 }
70 delete file;
71 return Status::OK();
72}
73
74// Called on every item found in a WriteBatch.
75class WriteBatchItemPrinter : public WriteBatch::Handler {

Callers 2

DumpLogFunction · 0.85
DumpDescriptorFunction · 0.85

Calls 4

OKFunction · 0.85
ReadRecordMethod · 0.80
LastRecordOffsetMethod · 0.80
NewSequentialFileMethod · 0.45

Tested by

no test coverage detected