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

Function read

plugins/experimental/inliner/cache-handler.h:186–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184 };
185
186 uint64_t
187 read(const TSIOBufferReader &r, std::string &o, int64_t l = 0)
188 {
189 assert(r != nullptr);
190 TSIOBufferBlock block = TSIOBufferReaderStart(r);
191
192 assert(l >= 0);
193 if (l == 0) {
194 l = TSIOBufferReaderAvail(r);
195 assert(l >= 0);
196 }
197
198 uint64_t length = 0;
199
200 for (; block && l > 0; block = TSIOBufferBlockNext(block)) {
201 int64_t size = 0;
202 const char *const pointer = TSIOBufferBlockReadStart(block, r, &size);
203 if (pointer != nullptr && size > 0) {
204 size = std::min(size, l);
205 o.append(pointer, size);
206 length += size;
207 l -= size;
208 }
209 }
210
211 return length;
212 }
213
214 struct CacheHandler {
215 std::string src_;

Callers 2

doneMethod · 0.70
hitMethod · 0.70

Calls 5

TSIOBufferReaderAvailFunction · 0.85
TSIOBufferReaderStartFunction · 0.50
TSIOBufferBlockNextFunction · 0.50
TSIOBufferBlockReadStartFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected