Skip to content

Commit

Permalink
Make it clearer when values are passed by reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
toregge committed Oct 11, 2024
1 parent fe5045a commit cbf4dd2
Show file tree
Hide file tree
Showing 37 changed files with 242 additions and 242 deletions.
4 changes: 2 additions & 2 deletions searchcore/src/tests/proton/common/index_writer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ struct MyIndexManager : public proton::test::MockIndexManager
return toString(removes[lid]);
}
// Implements IIndexManager
void putDocument(uint32_t lid, const Document &, SerialNum serialNum, OnWriteDoneType) override {
void putDocument(uint32_t lid, const Document &, SerialNum serialNum, const OnWriteDoneType&) override {
puts[lid].push_back(serialNum);
}
void removeDocuments(LidVector lids, SerialNum serialNum) override {
for (uint32_t lid : lids) {
removes[lid].push_back(serialNum);
}
}
void commit(SerialNum serialNum, OnWriteDoneType) override {
void commit(SerialNum serialNum, const OnWriteDoneType&) override {
commitSerial = serialNum;
}
SerialNum getCurrentSerialNum() const override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ struct MyFeedView : public test::DummyFeedView
void prepareRemove(RemoveOperation &) override { ++_prepareRemove; }
void handleRemove(FeedToken, const RemoveOperation &) override { ++_handleRemove; }
void prepareDeleteBucket(DeleteBucketOperation &) override { ++_prepareDeleteBucket; }
void handleDeleteBucket(const DeleteBucketOperation &, DoneCallback) override { ++_handleDeleteBucket; }
void handleDeleteBucket(const DeleteBucketOperation &, const DoneCallback&) override { ++_handleDeleteBucket; }
void prepareMove(MoveOperation &) override { ++_prepareMove; }
void handleMove(const MoveOperation &, DoneCallback) override { ++_handleMove; }
void heartBeat(SerialNum, DoneCallback) override { ++_heartBeat; }
void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &, DoneCallback) override { ++_handlePrune; }
void handleCompactLidSpace(const CompactLidSpaceOperation &op, DoneCallback) override {
void handleMove(const MoveOperation &, const DoneCallback&) override { ++_handleMove; }
void heartBeat(SerialNum, const DoneCallback&) override { ++_heartBeat; }
void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &, const DoneCallback&) override { ++_handlePrune; }
void handleCompactLidSpace(const CompactLidSpaceOperation &op, const DoneCallback&) override {
_wantedLidLimit = op.getLidLimit();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ struct MyFeedView : public test::DummyFeedView {
(void) token;
++remove_count;
}
void handleMove(const MoveOperation &, DoneCallback) override { ++move_count; }
void heartBeat(SerialNum, DoneCallback) override { ++heartbeat_count; }
void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &, DoneCallback) override { ++prune_removed_count; }
void handleMove(const MoveOperation &, const DoneCallback&) override { ++move_count; }
void heartBeat(SerialNum, const DoneCallback&) override { ++heartbeat_count; }
void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &, const DoneCallback&) override { ++prune_removed_count; }
const ISimpleDocumentMetaStore *getDocumentMetaStorePtr() const override {
return nullptr;
}
Expand Down
20 changes: 10 additions & 10 deletions searchcore/src/tests/proton/documentdb/feedview_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ struct MyIndexWriter : public test::MockIndexWriter
_wantedLidLimit(0),
_tracer(tracer)
{}
void put(SerialNum serialNum, const document::Document &doc, const DocumentIdT lid, OnWriteDoneType) override {
void put(SerialNum serialNum, const document::Document &doc, const DocumentIdT lid, const OnWriteDoneType&) override {
(void) doc;
_tracer.tracePut(indexAdapterTypeName, serialNum, lid);
}
Expand All @@ -170,7 +170,7 @@ struct MyIndexWriter : public test::MockIndexWriter
_tracer.traceRemove(indexAdapterTypeName, serialNum, lid);
}
}
void commit(SerialNum serialNum, OnWriteDoneType) override {
void commit(SerialNum serialNum, const OnWriteDoneType&) override {
++_commitCount;
_tracer.traceCommit(indexAdapterTypeName, serialNum);
}
Expand Down Expand Up @@ -343,26 +343,26 @@ struct MyAttributeWriter : public IAttributeWriter
auto itr = _attrMap.find(attrName);
return ((itr == _attrMap.end()) ? nullptr : itr->second.get());
}
void put(SerialNum serialNum, const document::Document &doc, DocumentIdT lid, OnWriteDoneType) override {
void put(SerialNum serialNum, const document::Document &doc, DocumentIdT lid, const OnWriteDoneType&) override {
_putSerial = serialNum;
_putDocId = doc.getId();
_putLid = lid;
_tracer.tracePut(attributeAdapterTypeName, serialNum, lid);
}
void remove(SerialNum serialNum, DocumentIdT lid, OnWriteDoneType) override {
void remove(SerialNum serialNum, DocumentIdT lid, const OnWriteDoneType&) override {
_removeSerial = serialNum;
_removeLid = lid;
_tracer.traceRemove(attributeAdapterTypeName, serialNum, lid);
}
void remove(const LidVector & lidsToRemove, SerialNum serialNum, OnWriteDoneType) override {
void remove(const LidVector & lidsToRemove, SerialNum serialNum, const OnWriteDoneType&) override {
for (uint32_t lid : lidsToRemove) {
LOG(info, "MyAttributeAdapter::remove(): serialNum(%" PRIu64 "), docId(%u)", serialNum, lid);
_removes.push_back(lid);
_tracer.traceRemove(attributeAdapterTypeName, serialNum, lid);
}
}
void update(SerialNum serialNum, const document::DocumentUpdate &upd,
DocumentIdT lid, OnWriteDoneType, IFieldUpdateCallback & onUpdate) override {
DocumentIdT lid, const OnWriteDoneType&, IFieldUpdateCallback & onUpdate) override {
_updateSerial = serialNum;
_updateDocId = upd.getId();
_updateLid = lid;
Expand All @@ -371,23 +371,23 @@ struct MyAttributeWriter : public IAttributeWriter
onUpdate.onUpdateField(fieldUpdate.getField(), attr);
}
}
void update(SerialNum serialNum, const document::Document &doc, DocumentIdT lid, OnWriteDoneType) override {
void update(SerialNum serialNum, const document::Document &doc, DocumentIdT lid, const OnWriteDoneType&) override {
(void) serialNum;
(void) doc;
(void) lid;
}
void heartBeat(SerialNum, OnWriteDoneType) override { ++_heartBeatCount; }
void heartBeat(SerialNum, const OnWriteDoneType&) override { ++_heartBeatCount; }
void compactLidSpace(uint32_t wantedLidLimit, SerialNum ) override {
_wantedLidLimit = wantedLidLimit;
}
const proton::IAttributeManager::SP &getAttributeManager() const override {
return _mgr;
}
void forceCommit(const CommitParam & param, OnWriteDoneType) override {
void forceCommit(const CommitParam & param, const OnWriteDoneType&) override {
++_commitCount;
_tracer.traceCommit(attributeAdapterTypeName, param.lastSerialNum());
}
void drain(OnWriteDoneType onDone) override {
void drain(const OnWriteDoneType& onDone) override {
(void) onDone;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ struct MyMinimalFeedView : public MyMinimalFeedViewBase, public StoreOnlyFeedVie
outstandingMoveOps(outstandingMoveOps_)
{
}
void removeAttributes(SerialNum s, const LidVector &l, OnWriteDoneType onWriteDone) override {
void removeAttributes(SerialNum s, const LidVector &l, const OnWriteDoneType& onWriteDone) override {
StoreOnlyFeedView::removeAttributes(s, l, onWriteDone);
++removeMultiAttributesCount;
}
void removeIndexedFields(SerialNum s, const LidVector &l, OnWriteDoneType onWriteDone) override {
void removeIndexedFields(SerialNum s, const LidVector &l, const OnWriteDoneType& onWriteDone) override {
StoreOnlyFeedView::removeIndexedFields(s, l, onWriteDone);
++removeMultiIndexFieldsCount;
}
void heartBeatIndexedFields(SerialNum s, DoneCallback onDone) override {
void heartBeatIndexedFields(SerialNum s, const DoneCallback& onDone) override {
StoreOnlyFeedView::heartBeatIndexedFields(s, onDone);
++heartBeatIndexedFieldsCount;
}
void heartBeatAttributes(SerialNum s, DoneCallback onDone) override {
void heartBeatAttributes(SerialNum s, const DoneCallback& onDone) override {
StoreOnlyFeedView::heartBeatAttributes(s, onDone);
++heartBeatAttributesCount;
}
Expand Down Expand Up @@ -146,26 +146,26 @@ struct MoveOperationFeedView : public MyMinimalFeedView {
onWriteDoneContexts()
{}
~MoveOperationFeedView() override;
void putAttributes(SerialNum, search::DocumentIdT, const document::Document &, OnPutDoneType onWriteDone) override {
void putAttributes(SerialNum, search::DocumentIdT, const document::Document &, const OnPutDoneType& onWriteDone) override {
++putAttributesCount;
EXPECT_EQUAL(1, outstandingMoveOps);
std::lock_guard guard(_mutex);
onWriteDoneContexts.push_back(onWriteDone);
}
void putIndexedFields(SerialNum, search::DocumentIdT, const document::Document::SP &,
OnOperationDoneType onWriteDone) override {
const OnOperationDoneType& onWriteDone) override {
++putIndexFieldsCount;
EXPECT_EQUAL(1, outstandingMoveOps);
std::lock_guard guard(_mutex);
onWriteDoneContexts.push_back(onWriteDone);
}
void removeAttributes(SerialNum, search::DocumentIdT, OnRemoveDoneType onWriteDone) override {
void removeAttributes(SerialNum, search::DocumentIdT, const OnRemoveDoneType& onWriteDone) override {
++removeAttributesCount;
EXPECT_EQUAL(1, outstandingMoveOps);
std::lock_guard guard(_mutex);
onWriteDoneContexts.push_back(onWriteDone);
}
void removeIndexedFields(SerialNum, search::DocumentIdT, OnRemoveDoneType onWriteDone) override {
void removeIndexedFields(SerialNum, search::DocumentIdT, const OnRemoveDoneType& onWriteDone) override {
++removeIndexFieldsCount;
EXPECT_EQUAL(1, outstandingMoveOps);
std::lock_guard guard(_mutex);
Expand Down
Loading

0 comments on commit cbf4dd2

Please sign in to comment.