MCPcopy Create free account
hub / github.com/apache/mesos / read

Method read

src/log/leveldb.cpp:433–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431
432
433Try<Action> LevelDBStorage::read(uint64_t position)
434{
435 Stopwatch stopwatch;
436 stopwatch.start();
437
438 leveldb::ReadOptions options;
439
440 string value;
441
442 leveldb::Status status = db->Get(options, encode(position), &value);
443
444 if (!status.ok()) {
445 return Error(status.ToString());
446 }
447
448 google::protobuf::io::ArrayInputStream stream(value.data(), value.size());
449
450 Record record;
451
452 if (!record.ParseFromZeroCopyStream(&stream)) {
453 return Error("Failed to deserialize record");
454 }
455
456 if (record.type() != Record::ACTION) {
457 return Error("Bad record");
458 }
459
460 VLOG(1) << "Reading position from leveldb took " << stopwatch.elapsed();
461
462 return record.action();
463}
464
465} // namespace log {
466} // namespace internal {

Callers

nothing calls this directly

Calls 9

GetMethod · 0.80
dataMethod · 0.80
typeMethod · 0.80
elapsedMethod · 0.80
actionMethod · 0.80
encodeFunction · 0.70
startMethod · 0.65
ErrorFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected