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

Method Read

src/leveldb/table/table_test.cc:128–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126 uint64_t Size() const { return contents_.size(); }
127
128 virtual Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const {
129 if (offset > contents_.size()) {
130 return Status::InvalidArgument("invalid Read offset");
131 }
132 if (offset + n > contents_.size()) {
133 n = contents_.size() - offset;
134 }
135 memcpy(scratch, &contents_[offset], n);
136 *result = Slice(scratch, n);
137 return Status::OK();
138 }
139
140 private:
141 std::string contents_;

Callers 3

DoCopyToLocalMethod · 0.45
ReadSstFileFunction · 0.45

Calls 2

SliceClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected