MCPcopy Create free account
hub / github.com/apache/impala / ChunkIOVec

Function ChunkIOVec

security/tls_socket-test.cc:259–271  ·  view source on GitHub ↗

Return an iovec containing the same data as the buffer 'buf' with the length 'len', but split into random-sized chunks. The chunks are sized randomly between 1 and 'max_chunk_size' bytes.

Source from the content-addressed store, hash-verified

257// but split into random-sized chunks. The chunks are sized randomly between 1 and
258// 'max_chunk_size' bytes.
259vector<struct iovec> ChunkIOVec(Random* rng, uint8_t* buf, int len, int max_chunk_size) {
260 vector<struct iovec> ret;
261 uint8_t* p = buf;
262 int rem = len;
263 while (rem > 0) {
264 int len = rng->Uniform(max_chunk_size) + 1;
265 len = std::min(len, rem);
266 ret.push_back({p, static_cast<size_t>(len)});
267 p += len;
268 rem -= len;
269 }
270 return ret;
271}
272
273// Regression test for KUDU-2218, a bug in which Writev would improperly handle
274// partial writes in non-blocking mode.

Callers 1

TEST_FFunction · 0.70

Calls 3

minFunction · 0.85
push_backMethod · 0.80
UniformMethod · 0.45

Tested by

no test coverage detected