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

Method MakeLogFile

src/leveldb/db/recovery_test.cc:139–150  ·  view source on GitHub ↗

Directly construct a log file that sets key to val.

Source from the content-addressed store, hash-verified

137
138 // Directly construct a log file that sets key to val.
139 void MakeLogFile(uint64_t lognum, SequenceNumber seq, Slice key, Slice val) {
140 std::string fname = LogFileName(dbname_, lognum);
141 WritableFile* file;
142 ASSERT_OK(env_->NewWritableFile(fname, &file));
143 log::Writer writer(file);
144 WriteBatch batch;
145 batch.Put(key, val);
146 WriteBatchInternal::SetSequence(&batch, seq);
147 ASSERT_OK(writer.AddRecord(WriteBatchInternal::Contents(&batch)));
148 ASSERT_OK(file->Flush());
149 delete file;
150 }
151
152 private:
153 std::string dbname_;

Callers

nothing calls this directly

Calls 5

LogFileNameFunction · 0.85
AddRecordMethod · 0.80
NewWritableFileMethod · 0.45
PutMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected