MCPcopy Create free account
hub / github.com/apache/brpc / Flush

Method Flush

src/brpc/memcache.cpp:309–333  ·  view source on GitHub ↗

MAY have extras. MUST NOT have key. MUST NOT have value. Extra data for flush: Byte/ 0 | 1 | 2 | 3 | / | | | | |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| +---------------+---------------+---------------+---------------+ 0| Expiration

Source from the content-addressed store, hash-verified

307// +---------------+---------------+---------------+---------------+
308// Total 4 bytes
309bool MemcacheRequest::Flush(uint32_t timeout) {
310 const uint8_t FLUSH_EXTRAS = (timeout == 0 ? 0 : 4);
311 FlushHeaderWithExtras header_with_extras = {{
312 policy::MC_MAGIC_REQUEST,
313 policy::MC_BINARY_FLUSH,
314 0,
315 FLUSH_EXTRAS,
316 policy::MC_BINARY_RAW_BYTES,
317 0,
318 butil::HostToNet32(FLUSH_EXTRAS),
319 0,
320 0 }, butil::HostToNet32(timeout) };
321 if (FLUSH_EXTRAS == 0) {
322 if (_buf.append(&header_with_extras.header,
323 sizeof(policy::MemcacheRequestHeader))) {
324 return false;
325 }
326 } else {
327 if (_buf.append(&header_with_extras, sizeof(header_with_extras))) {
328 return false;
329 }
330 }
331 ++_pipelined_count;
332 return true;
333}
334
335// (if found):
336// MUST have extras.

Callers 2

TESTFunction · 0.45
TEST_FFunction · 0.45

Calls 2

HostToNet32Function · 0.85
appendMethod · 0.45

Tested by 2

TESTFunction · 0.36
TEST_FFunction · 0.36