MCPcopy Create free account
hub / github.com/baidu/tera / ReadMetaFromStream

Function ReadMetaFromStream

src/admincli.cc:715–738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713}
714
715bool ReadMetaFromStream(std::ifstream& ifs, std::string* key, std::string* value) {
716 uint32_t key_size = 0, value_size = 0;
717 ifs.read((char*)&key_size, sizeof(key_size));
718 if (ifs.eof() && ifs.gcount() == 0) {
719 key->clear();
720 value->clear();
721 return true;
722 }
723 key->resize(key_size);
724 ifs.read((char*)key->data(), key_size);
725 if (ifs.fail()) {
726 return false;
727 }
728 ifs.read((char*)&value_size, sizeof(value_size));
729 if (ifs.fail()) {
730 return false;
731 }
732 value->resize(value_size);
733 ifs.read((char*)value->data(), value_size);
734 if (ifs.fail()) {
735 return false;
736 }
737 return true;
738}
739
740int ReadMetaTabletFromFile(const std::string& filename) {
741 std::ifstream ifs(filename.c_str(), std::ofstream::binary);

Callers 1

ReadMetaTabletFromFileFunction · 0.85

Calls 3

readMethod · 0.80
dataMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected