MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Flush

Method Flush

phxqueue/store/syncctrl.cpp:292–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292comm::RetCode SyncCtrl::Flush(const int sub_id, const int queue_id) {
293 auto opt(impl_->store->GetStoreOption());
294
295 if (!sub_id || sub_id > opt->nsub || queue_id >= opt->nqueue)
296 return comm::RetCode::RET_ERR_ARG;
297
298 size_t idx;
299 GetIdx(opt->nsub, sub_id, queue_id, idx);
300
301 std::lock_guard<mutex> lock_guard(impl_->locks[idx]);
302
303 auto &&item(impl_->buf[idx]);
304 if (0 != msync(&item, ((size_t)(&item.reserved[0]) - (size_t)(&item)), MS_SYNC)) {
305 QLErr("msync err %s", strerror(errno));
306 return comm::RetCode::RET_ERR_SYS;
307 }
308 return comm::RetCode::RET_OK;
309}
310
311comm::RetCode SyncCtrl::GetBackLogByCursorID(const int queue_id,
312 const uint64_t cursor_id, int &backlog) {

Callers

nothing calls this directly

Calls 2

GetIdxFunction · 0.85
GetStoreOptionMethod · 0.80

Tested by

no test coverage detected