MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / Read

Method Read

src/log/sequential_file.cc:48–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 virtual ~PosixSequentialFile() { fclose(file_); }
47
48 virtual Status Read(size_t n, Slice* result, char* scratch) {
49 Status s;
50#if __linux__
51 size_t r = fread_unlocked(scratch, 1, n, file_);
52#else
53 size_t r = fread(scratch, 1, n, file_);
54#endif
55 *result = Slice(scratch, r);
56 if (r < n) {
57 if (feof(file_)) {
58 // We leave status as ok if we hit the end of the file
59 } else {
60 // A partial read with an error: return a non-ok status
61 s = Status::IOError(filename_, strerror(errno));
62 }
63 }
64 return s;
65 }
66
67 virtual Status Skip(uint64_t n) {
68 if (fseek(file_, n, SEEK_CUR)) {

Callers 1

ReadPhysicalRecordMethod · 0.80

Calls 2

IOErrorFunction · 0.85
SliceClass · 0.70

Tested by

no test coverage detected