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

Method PushBack

phxqueue/store/storemeta.cpp:158–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158bool StoreMetaQueue::PushBack(StoreMeta &&meta) {
159 lock_guard<mutex> lock_guard(impl_->lock);
160
161 if (-1 == meta.GetCursorID()) return false;
162 if (!impl_->metas.empty() && !((*impl_->metas.rbegin()) < meta)) return false;
163 if (!impl_->metas.empty()) {
164 auto &&pre_meta = *impl_->metas.rbegin();
165 meta.UpdateCrc(pre_meta.GetCrc());
166 meta.SetIndex(pre_meta.GetIndex() + 1);
167 } else {
168 meta.UpdateCrc(impl_->last_dequeue_meta.GetCrc());
169 meta.SetIndex(0);
170 }
171 impl_->metas.insert(forward<StoreMeta>(meta));
172 return true;
173}
174
175
176bool StoreMetaQueue::Front(StoreMeta &meta) {

Callers 1

AddMethod · 0.80

Calls 5

UpdateCrcMethod · 0.80
GetCrcMethod · 0.80
SetIndexMethod · 0.80
GetIndexMethod · 0.80
GetCursorIDMethod · 0.45

Tested by

no test coverage detected