MCPcopy Create free account
hub / github.com/apache/arrow / TellOr

Method TellOr

cpp/src/arrow/filesystem/gcsfs.cc:126–136  ·  view source on GitHub ↗

At EOF, gcs::ObjectReadStream::tellg() returns -1, but our APIs canonically return the stream size. This method helps with the conversion.

Source from the content-addressed store, hash-verified

124 // At EOF, gcs::ObjectReadStream::tellg() returns -1, but our APIs canonically return
125 // the stream size. This method helps with the conversion.
126 Result<int64_t> TellOr(int64_t max_pos) const {
127 if (closed()) return Status::Invalid("Cannot use Tell() on a closed stream");
128 int64_t pos = stream_.tellg();
129 if (pos < 0) {
130 if (!stream_.eof()) {
131 return Status::IOError("Tell() failed before end of stream");
132 }
133 return max_pos;
134 }
135 return pos;
136 }
137
138 // A gcs::ObjectReadStream can be "born closed". For small objects the stream returns
139 // `IsOpen() == false` as soon as it is created, but the application can still read from

Callers 1

TellMethod · 0.80

Calls 3

closedFunction · 0.85
IOErrorFunction · 0.85
InvalidFunction · 0.50

Tested by

no test coverage detected